简体   繁体   English

如何将多个服务部署到 AWS ECS?

[英]How to deploy multiple services to AWS ECS?

I have a docker-compose setup made up with 2+ containers that I use for local development.我有一个 docker-compose 设置,由我用于本地开发的 2 个以上的容器组成。 I'm trying to deploy the following to AWS ECS and I successfully deployed the first service but I'm struggling deploying more.我正在尝试将以下内容部署到 AWS ECS 并且我成功部署了第一个服务,但我正在努力部署更多服务。 It seems like I'm missing something in the configuration.好像我在配置中遗漏了一些东西。

To deploy the first service to ECS, I followed these steps:为了将第一个服务部署到 ECS,我遵循了以下步骤:

  1. Deployed docker image to ECR将 docker 镜像部署到 ECR
  2. Created an ECS cluster创建ECS集群
  3. Created a task that I attached my ECR image to创建了一个任务,我将我的 ECR 图像附加到
  4. Configured a VPC配置专有网络
  5. Configured ELB配置的ELB
  6. Successfully launched a new instance inside of my ECS container在我的 ECS 容器内成功启动了一个新实例

To deploy the second service, I'm trying to follow steps 1,3 and 6 and it seems like it's deployed successfully.要部署第二个服务,我正在尝试按照步骤 1,3 和 6 进行操作,并且似乎已成功部署。 However, when I try to hit any endpoint from the second service, it results in /404 at the first one.但是,当我尝试从第二个服务访问任何端点时,第一个服务会导致 /404。

As I understand, my current ELB configuration is set up to route all the traffic to the first instance, so my question is - which steps I should also re-use while deploying the 2nd service?据我了解,我当前的 ELB 配置设置为将所有流量路由到第一个实例,所以我的问题是 - 在部署第二个服务时我还应该重用哪些步骤? Should it have a separate ELB and security group?它应该有一个单独的 ELB 和安全组吗?

I tried googling it but all the articles are about deploying a single instance which I had no problems with.我尝试使用谷歌搜索它,但所有文章都是关于部署我没有问题的单个实例。

You dont need to create a cluster for second service.您不需要为第二个服务创建集群。 You need create another task definition with new image of second service (deployed to the ECR).您需要使用第二个服务的新映像(部署到 ECR)创建另一个任务定义。 Next step is create a service in the cluster and setup Service discovery in the Configure network step.下一步是在集群中创建一个服务并在配置网络步骤中设置服务发现

Documentation

You might want to consider this: https://docs.docker.com/engine/context/ecs-integration/ .您可能需要考虑这个: https : //docs.docker.com/engine/context/ecs-integration/ It's still in beta but it can deploy your compose file directly to ECS for you.它仍处于测试阶段,但它可以为您将撰写文件直接部署到 ECS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM