We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

ECS Services

Finally! Time to build the ECS Service that ties everything together, and answers these questions:

  • Where do we place our tasks?
  • How do we scale them?
  • How do we connect to the load balancer?

Once we create an ECS service with load balancer settings, ECS automatically registers tasks with the target group as they start.

Assignment

Create an ECS service patientping-svc that runs your task definition and connects it to the load balancer (cluster patientping-ecs, ALB patientping-alb, target group patientping-tg).

Cost check: An ECS service creates the serverless containers (Fargate tasks). It costs about $0.012/hr for the task. The load balancer we created earlier costs about $0.0225/hr (~$16/mo). Combined, you're looking at roughly $0.0345/hr or about $25/mo total! Don't leave these up if you're going to step away from the lessons.

      • Family (task definition) to patientping-ecs.
      • Service name to patientping-svc.
      • Now you may wonder why we're using a public subnet. Well, when a new Fargate container starts, it needs to be able to interact with the container repository (ECR) and pull in a fresh container. Putting this in a public subnet means it can just leverage our internet gateway, and save us from setting up a specific endpoint to fetch them privately.

    1. It may take a minute or two for the service to start tasks and register them with the load balancer. Once they're registered, your containers will be ready to receive traffic through the load balancer.

    1. Remember, we set this service up with permissions to read the /CMO_NAME from SSM parameters!

Run and submit the tests to verify your ECS service is running correctly.