Step 5: Create the ECS Service and Load Balancer

Create an ECS Service from Task Definition and expose it with a Load Balancer

Now that you've created a Task Definition, you create a Service, which creates a Task (from the definition) to run your application. A Task is the instantiation of a Task Definition within a cluster. After you create a task definition for your application within Amazon ECS, you can specify multiple tasks to run on your cluster, based on your performance and availability requirements.

Once a Service is created, you must create a Load Balancer to expose the Service on the network. An Amazon ECS service runs and maintains the desired number of tasks simultaneously in an Amazon ECS cluster. If any of your tasks fail or stop for any reason, the Amazon ECS service scheduler launches another instance based on parameters specified in your Task Definition. It does so in order to maintain the desired number of tasks created.

Estimated time to complete Step 5: 10 minutes.

Prerequisites

Before creating the ECS Service and Load Balancer, verify that you accomplished the tasks in the previous tutorial steps. Using the DuploCloud Portal, confirm that:

Creating an ECS Service and a Load Balancer

Tasks run until an error occurs or a user terminates the Task in the ECS Cluster.

  1. In the DuploCloud Portal's Tenant list box. select Tenant dev01.

  2. Navigate to Cloud Services -> ECS.

  3. In the Task Definitions tab, select the Task Definition Family Name, DUPLOSERVICES-DEV01-SAMPLE-TASK-DEF. This is the Task Definition Name that you created prepended by a unique identified, which includes your Tenant name (DEV01) and part of your Infrastructure name (ECS-TEST).

  4. In the Service Details tab, click the Configure ECS Service link. The Add ECS Service page displays.

  1. In the Name field, enter sample-httpd-app as the Service name.

  2. In the LB Listeners area, click Add. The Add Load Balancer Listener pane displays.

  3. From the Select Type list box, select Application LB.

  4. In the Container Port field, enter 3000.

  5. In the External Port field, enter 80.

  6. From the Visibility list box, select Public.

  7. In the Heath Check field, enter /, specifying root, the location of Kubernetes Health Check logs.

  8. From the Backend Protocol list box, select HTTP.

  9. From the Protocol Policy list box, select HTTP1.

  10. Select other options as needed and click Add.

  11. On the Add ECS Service page, click Submit.

Checking Your Work

In the Service Details tab, information about the Service and Load Balancer you created is displayed. Verify that the Service and Load Balancer configuration details in the Service Details tab are correct.

Last updated

Logo

© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates