我刚刚开始使用AWS EC2。我知道EC2就像一台远程计算机,在那里我可以做几乎所有我想做的事情。然后我发现了ECS。我知道它使用Docker,但我对这两者之间的关系感到困惑。

ECS只是EC2中的Docker安装吗? 如果我已经有一个EC2并且我启动了一个ECS,这是否意味着我有两个实例?


当前回答

EC2 allows you to launch individual instances which you can use for pretty much whatever you like. ECS is a container service, which means it will launch instances that will be ready to launch container applications. The main distinction between the two services is that with EC2 you have to manage each instance separately in whatever method you choose (manually, using a CM tool or any other way) - deploy your applications and maintain the connection between the servers yourself. ECS allows you to launch a cluster of machines that will serve as the deployment ground of your container apps, allowing you to treat all instances in the cluster as one big instance available for your container workload.

回答你的问题——你可以在没有实例的情况下启动一个ECS集群,但是这样它就不能在上面运行任何东西。一旦在ECS集群中注册了EC2实例,容器就可以在其中运行了。因此,底线是—您可以仅对一个实例同时使用ECS和EC2,但这不是构建这些服务的实际用例。

其他回答

ECS是一个容器编配器,就像Kubernetes或Docker swarm, EC2是一个用于创建虚拟机的Amazon弹性计算云平台。ECS允许您在无服务器环境(Fargate)上运行容器,无需运行任何VM,也可以在非托管环境中运行容器,在EC2实例上托管容器。

好的,如你所知,EC2是AWS上的虚拟机,ECS是AWS上的容器编排系统。

要使用ECS,您需要将容器运行到一些虚拟机中,EC2是提供该功能的选项之一。

您需要在EC2上安装ECS -agent,以便与ECS建立连接。ECS还可以监视EC2上的资源使用情况。所以基本上你可以选择更高级的EC2类型,然后你的容器可以使用更多的资源(CPU/MEM)。

简单地说,ECS是一个经理,而EC2实例就像员工。 该经理(ECS)下的所有员工(EC2)都能执行“Docker”任务,该经理也很了解“Docker”。因此,无论何时您需要“docker”资源,您都可以出现在Manager面前。经理已经拥有每个员工(EC2)的地位,决定谁应该执行任务。

现在,回到你的问题,一个没有“员工”的经理是没有意义的,但绝对是可能的。

ECS stands for 'Elastic Container Service'. It is a container orchestration service. Lets say you have a Docker container running and you decide to update the Docker image. It's relatively easy task to stop, pull and run if you have one container running but its tedious to do the same steps if you have 10 to 100 of containers running. With AWS ECS you can have this control. You specify if update is required provide the latest image id and ECS will handle the stop, pull and run etc. commands for you. It also provides with much more additional features, refer - https://aws.amazon.com/ecs/features/ EC2 stand for 'Elastic Compute Cloud'. In simple terms its a virtual machine. ECS uses EC2 to run your containers. 'These running docker containers (tasks) are run on EC2 instances'.

EC2是一个让应用程序能够在AWS上运行的计算服务,而ECS是一个主要用于编排Docker容器的AWS服务。