1. Create private AWS ECR repository

  1. Create private AWS ECR repository named “ecs-container-repo”

  2. Push the locally stored image to the “ecs-container-repo” repository

  3. Create an IAM role named “ecs-task-role” that will be “Elastic Container Service Task” based and have two policies attached to it: “AmazonECSTaskExecutionRolePolicy” and “CloudWatchLogsFullAccess”

  4. Create an ECS Cluster named “ecs-demo-cluster” with the launch type as “AWS Fargate (serverless)”

  5. Create a task definition under “ecs-demo-cluster”, named “ecs-demo-task-definition” with the following configurations:

    • Launch type: AWS Fargate
    • Operating System/Architecture: Linux/X86_64
    • CPU: .5 vCPU
    • Memory: 1 GB
    • Task Role: None
    • Task execution role: ecs-task-role
    • Container name: ecs-demo-app
    • Image URI: <ECR repository URI created in step 2>
    • Container port: 80
  6. Create a new security group “ecs-demo-app-sg” with description “ECS Demo App Security Group” and add a inbound rule to allow HTTP traffic on port 80 from anywhere.

  7. Deploy task definition

Now run new task “ecs-demo-task-definition” keep “Launch type” as “FARGATE” and the “Platform version” as “LATEST.” Select us-east-1a as “Subnets”