使用多容器系统。我正在评估弹性豆茎和ECS的优缺点。有很多像this这样的问题,说与EC相比,ECS对容器有更精确的控制,但是没有列出。在我看来,这是它们之间的区别:
+--------------------------------------------+--------------------------------------------------+
| Elastic Beanstalk | ECS |
+--------------------------------------------+--------------------------------------------------+
| Natively support auto-scaling and load | Auto-scaling can be done with |
| balancing. Has the ability to deploy | some extra efforts. But other AWS resources |
| other AWS resources along with the | cannot be deployed with ECS. |
| containers. | |
+--------------------------------------------+--------------------------------------------------+
| Container definitions are written in | Container definitions has to be written in a |
| dockerrun.aws.json file. All the links | separate task definition file. Scaling of the |
| can be written here. This is more like | container can be specified in |
| docker compose file. | service definitions. |
+--------------------------------------------+--------------------------------------------------+
| Scaling happens based on CloudWatch | Here, we have a precise control to scale |
| metric. But when a new instance is | a particular task (container). This is more |
| launched, the whole containers in | like declarative. It does not take in to account |
| task definition file will be launched | about the instances, it maintains the count of |
| again (imperative), even though some | tasks correctly. Scales based on the |
| of the containers actually has no traffic. | CPU/Memory usage of a specific container. |
+--------------------------------------------+--------------------------------------------------+
我不确定第三点。纠正我如果我错了。如果这两者之间存在其他差异,请告诉我。
答案 0 :(得分:6)
第一点:如果您不使用Elastic Beanstalk并希望在应用程序中部署其他AWS资源,请创建CloudFormation模板并使用CloudFormation更改集启动,升级和拆除您的应用程序。
关于第三点,Elastic Beanstalk使用AWS Auto Scaling功能,该功能仅适用于创建和删除EC2实例的级别。因此,如果您在Elastic Beanstalk中使用单个容器/多容器环境,则扩展不仅会创建另一个容器,而是一个运行Docker的整个EC2实例,其中包含所有相同的容器。也可以在不使用Elastic Beanstalk的情况下从CloudFormation模板使用Auto Scaling。它仍然只适用于EC2实例的级别。
另一种选择是将Elastic Beanstalk与其Auto Scaling一起使用,将环境设置为具有您想要缩放的容器的单个容器docker,并将其他容器添加为AWS::ECS::Service custom resources。例如,您的单个容器可以是处理繁重的前端,而另一个容器可以是共享数据存储。这样,您可以从Elastic Beanstalk获得良好的版本控制/部署/部署,但是具有单实例的容器(每个Elastic Beanstalk环境)。