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.
-
Access to AWS ECS interface
- Select Cluster
- Select Services
- Select Create
-
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
-
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
-
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
-
In terms of Load balancing
- Select Application Load Balancer
- Select Load balancer name created.
- Select Add to load balancer
-
Configure Container to load balancer
- For Production listener port select port 8080
- Select Test listener
- Select Test listener port as 9090.
- Select Next step
- Select Next step
- For Set Auto Scaling, select Do not adjust the service’s desired count
- Check again and select Create Service
- Finish creating service, select View Service
- About 2 minutes later, check the task in RUNNING status, select task.
- See details of the first task and notes Public IP
- View second task details and notes Public IP
- Use Public IP of the first task and with port 5000 we will access the application.
- Similarly, we use Public IP of the second task and with port 5000 we will access the application.