- Docker on Amazon Web Services
- Justin Menga
- 617字
- 2025-02-17 05:10:17
Creating an ECS cluster
To help you understand the basics of ECS, we will now step through a series of configuration tasks using the AWS console.
We will first create an ECS cluster, which is a collection of ECS container instances that will run your container applications, and often are closely related to EC2 Auto Scaling groups, as shown in the following figure.
Creating an ECS cluster can be performed using the following steps:
- From the main AWS console, select Services | Elastic Container Service within the Compute section.
- If you haven't used or configured ECS before in your AWS account and region, you will be presented with a Welcome screen, and you can invoke a getting started configuration wizard by clicking the Get started button.
- At at the time of writing, the getting started wizard only allows you to get started using the Fargate deployment type. We will learn about Fargate in later chapters, so scroll to the bottom of the screen and click on Cancel.
- You will be returned to the ECS console and we can now get started creating an ECS cluster by clicking on the Create Cluster button.
- On the Select cluster template screen, select the EC2 Linux + Networking template, which will set up network resources and an EC2 autoscaling group with support for Docker for Linux by launching EC2 instances based upon a special ECS-optimized Amazon Machine Image (AMI) that we'll learn more about later on. Once complete, click on Next step to continue.
- On the Configure cluster screen, configure a cluster name of test-cluster, ensure the EC2 instance type is set to t2.micro to qualify for free tier access, and set the Key pair to the EC2 key pair you created in earlier chapters. Notice that a new VPC and subnets will be created, along with a security group that permits inbound web access (TCP port 80) from the internet (0.0.0.0/0). Once complete, click on Create to commence creation of the cluster:

- At this point, the Launch status screen will be displayed and a number of resources will be created that are required to support your ECS cluster. Once the cluster creation is complete, click on the View Cluster button to continue.
You will now be taken to the details screen for the test-cluster that was just created. Congratulations—you have successfully deployed your first ECS cluster!
The cluster details screen provides you with configuration and operational data about your ECS cluster—for example, if you click on the ECS Instances tab, you are presented with a list of each of the ECS container instances in the cluster:

You can see that the wizard created a single container instance, which is running from an EC2 instance that is deployed to the displayed availability zone. Note you can also see other information about the ECS container instance, such as ECS agent version and status, running tasks, CPU/memory usage, along with the version of the Docker Engine.
There's not much more than this to an ECS cluster—it is essentially a collection of ECS container instances, which in turn are EC2 instances running the Docker Engine along with an ECS agent that provide CPU, memory, and networking resources for running your containers.