Create ECS Service

Create ECS Service

In Amazon ECS, a Service is a configuration that allows running one or more consecutive tasks in a cluster and maintaining them automatically. Tasks and services can be run on serverless infrastructures (managed by AWS Fargate) or through your own managed infrastructure such as an EC2 cluster.

  1. Access to AWS ECS interface

    • Select Cluster
    • Select Services
    • Select Create

ECS Lab

  1. Perform service configuration

    • Select FARGATE
    • Operating system family select Linux
    • Select the created Task definitions.
    • Select the created Cluster.
    • Enter Service name.
    • For Number of tasks, select 2

ECS Lab

  1. Select the Deployment type

    • Select Blue/green deployment (powered by AWS CodeDeploy)
    • Select Deployment configuration
    • Select the created Service role for CodeDeploy.
    • Select Next step

ECS Lab

  1. Perform network configuration

    • Select Cluster VPC, select container-vpc
    • Choose 2 public subnets.
    • Select the security group of the application.
    • Check Auto-assign public IP

ECS Lab

  1. In terms of Load balancing

    • Select Application Load Balancer
    • Select Load balancer name created.
    • Select Add to load balancer

ECS Lab

  1. Configure Container to load balancer

    • For Production listener port select port 8080
    • Select Test listener
    • Select Test listener port as 9090.
    • Select Next step

ECS Lab

  1. Select Next step

ECS Lab

  1. For Set Auto Scaling, select Do not adjust the service’s desired count

ECS Lab

  1. Check again and select Create Service

ECS Lab

  1. Finish creating service, select View Service

ECS Lab

  1. About 2 minutes later, check the task in RUNNING status, select task.

ECS Lab

  1. See details of the first task and notes Public IP

ECS Lab

  1. View second task details and notes Public IP

ECS Lab

  1. Use Public IP of the first task and with port 5000 we will access the application.

ECS Lab

  1. Similarly, we use Public IP of the second task and with port 5000 we will access the application.

ECS Lab