Create an application for an Amazon ECS service deployment (console) - AWS CodeDeploy

Create an application for an Amazon ECS service deployment (console)

You can use the CodeDeploy console to create an application for an Amazon ECS service deployment.

  1. Sign in to the AWS Management Console and open the CodeDeploy console at https://console.aws.amazon.com/codedeploy.

    Note

    Sign in with the same user that you set up in Getting started with CodeDeploy.

  2. In the navigation pane, expand Deploy, and choose Getting started.

  3. On the Create application page, choose Use CodeDeploy.

  4. In Application name, enter the name of your application.

  5. From Compute platform, choose Amazon ECS.

  6. Choose Create application.

  7. On your application page, from the Deployment groups tab, choose Create deployment group. For more information about what you need to create a deployment group for an Amazon ECS deployment, see Before you begin an Amazon ECS deployment.

  8. In Deployment group name, enter a name that describes the deployment group.

    Note

    If you want to use the same settings used in another deployment group (including the deployment group name and the deployment configuration), choose those settings on this page. Although this new group and the existing group might have the same name, CodeDeploy treats them as separate deployment groups, because each is associated with a separate application.

  9. In Service role, choose a service role that grants CodeDeploy access to Amazon ECS. For more information, see Step 2: Create a service role for CodeDeploy.

  10. From Load balancer name, choose the name of the load balancer that serves traffic to your Amazon ECS service.

  11. From Production listener port, choose the port and protocol for the listener that serves production traffic to your Amazon ECS service.

  12. (Optional) From Test listener port, choose the port and protocol of a test listener that serves traffic to the replacement task set in your Amazon ECS service during deployment. You can specify one or more Lambda funtions in the AppSpec file that run during the AfterAllowTestTraffic hook. The functions can run validation tests. If a validation test fails, a deployment rollback is triggered. If the validation tests succeed, the next hook in the deployment lifecycle, BeforeAllowTraffic, is triggered. If a test listener port is not specified, nothing happens during the AfterAllowTestTraffic hook. For more information, see AppSpec 'hooks' section for an Amazon ECS deployment.

  13. From Target group 1 name and Target group 2 name, choose the target groups used to route traffic during your deployment. CodeDeploy binds one target group to your Amazon ECS service's original task set and the other to its replacement task set. For more information, see Target Groups for Your Application Load Balancers.

  14. Choose Reroute traffic immediately or Specify when to reroute traffic to determine when to reroute traffic to your updated Amazon ECS service.

    If you choose Reroute traffic immediately, then the deployment automatically reroutes traffic after the replacement task set is provisioned.

    If you choose Specify when to reroute traffic, then choose the number of days, hours, and minutes to wait after the replacement task set is successfully provisioned. During this wait time, validation tests in Lambda functions specified in the AppSpec file are executed. If the wait time expires before traffic is rerouted, then the deployment status changes to Stopped.

  15. For Original revision termination, choose the number of days, hours, and minutes to wait after a successful deployment before the original task set in your Amazon ECS service is terminated.

  16. (Optional) In Advanced, configure any options you want to include in the deployment, such as Amazon SNS notification triggers, Amazon CloudWatch alarms, or automatic rollbacks.

    For more information, see Configure advanced options for a deployment group.