Create ECS Cluster

Create ECS Cluster

In this section, we will create an ECS cluster to run the serverless application.

  1. Go to the ECS console and click on the Create Cluster button. Container Container
  • Configure the cluster as shown below and click on the Create button.
    • Cluster name: docker-container-ecs
    • In infrastructure, select AWS Fargate (serverless) Container Container
  1. Next, we create a task definition.

    In AWS ECS, a task definition is a blueprint that specifies how Docker containers should be configured and run, detailing the Docker images, CPU and memory requirements, networking settings like port mappings, environment variables, and data volumes.

  • Click Task Definition and choose Create new Task Definition. Container
  • Configure the task definition as shown below and click on the Create button.
    • Task definition family: docker-container-task
    • Launch type: FARGATE
    • Task execution role: ecsTaskExecutionRole. You can choose Create new role if you don’t have one. Container Container
  • Next configure the container definition as shown below:
    • Name: container-01
    • Image URL: you can find the recent repository URL in the ECR repository.
    • Port mappings: 8000
    • Choose Create Container Container