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

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


当前回答

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

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

其他回答

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 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服务。

简单地说,弹性容器服务(ECS)是一种Docker容器编排服务。

你可以让它运行一个或多个Docker映像,可以作为一个可自动伸缩的“服务”,也可以作为一个特别的“任务”。

The services and tasks run on a "Cluster". Originally, a Cluster was a group of one or more pre-configured EC2 servers running ECS Cluster Agent. The Cluster Agent would schedule the containers on the EC2 server. These EC2 servers show up in your EC2 Instances list and are charged at regular EC2 per-minute costs - You can even SSH onto them like any normal EC2 server. If you wanted more capacity to run more Services or Tasks, or if you wanted resilience against EC2 failure, then you would more EC2 servers.

2017年11月左右,AWS增加了ECS Fargate。现在,集群可以“无服务器”运行,无需提供EC2节点。您只需定义任务或服务操作所需的CPU和内存数量,这意味着您只需支付CPU和内存时间,而不是EC2。

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

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

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