From Day 8, tasks are one-off. Services run tasks continuously.
Creating a Service
Console: ECS > Clusters > my-cluster > Create service > Fargate, task def: my-task, desired tasks: 1.
CLI:
aws ecs create-service --cluster my-cluster --service-name my-service --task-definition my-task --desired-count 1 --launch-type FARGATE --network-configuration "awsvpcConfiguration={subnets=[subnet-id],securityGroups=[sg-id],assignPublicIp=ENABLED}"
Access via public IP (from task details).
Managing Services
Update: aws ecs update-service --cluster my-cluster --service my-service --desired-count 2
Rollback: Via console revisions.
Delete: aws ecs delete-service --cluster my-cluster --service my-service --force
Today’s Takeaway
Services deployed!
What’s Next?
In Day 10, we’ll explore networking.
Top comments (0)