Deploy sample containerized application on ECS using CodeDeploy

Lab Details

  1. This lab walks you through how to deploy sample containerized applications on ECS using AWS CodeDeploy.

  2. Duration: 120 minutes

  3. AWS Region: US East (N. Virginia) us-east-1

Introduction

What is AWS CodeDeploy?

  1. AWS CodeDeploy helps you automate your application deployment of a variety of computing services such as Amazon EC2, AWS Lambda, AWS Fargate, and on-premise servers.

  2. Using CodeDeploy, we can deploy the following types of content:

    • Code

    • Serverless AWS Lambda functions

    • Web and configuration files

    • Executables Packages

    • Scripts

    • Multimedia files

  3. The source code of the application can be stored in S3 Bucket. CodeCommit is a git-based repository such as GitHub or BitBucket.

  4. CodeDeploy helps us in rapidly releasing new features, updating AWS Lambda functions version, to avoid downtime during application deployments and handle the complexity of applications deployments where manual deployments are error-prone.

  5. To work with various systems for configuration management, source control, continuous integration (CI) and continuous delivery (CD), you can use CodeDeploy.

  6. CodeDeploy can be used for the following types of deployment:

    • Applications that require servers like Amazon EC2, On-premise server.

    • Applications that are serverless, using AWS Lambda.

    • Containerized applications deployed on Amazon ECS.

  7. AWS CodeDeploy supports two types of deployment:

    • In-place deployment: For this method, you stop the deployment of applications present on every instance and install a revised application. Once the newer version of the application is deployed the application starts and gets validated. 

      • Note: AWS Lambda and Amazon ECS deployments, do not support in-place deployments.

    • Blue-green deployment: For this deployment type, the characteristics of deployment depend on the type of computing platform used for deployment.

      • EC2 or On-premise platform

      • AWS Lambda

      • Amazon ECS

Task Details

  1. Log in to the AWS Management Console.

  2. Create a Security Group for the load balancer.

  3. Create the Load balancer.

  4. Create the second listener, required during deployment in CodeDeploy.

  5. Create an Environment in CloudShell.

  6. Create an ECS Cluster, register task definition, and create an ECS service.

  7. Create a new revision of the task definition and add tags.

  8. Update the appspec.yml files and upload it back to the S3 bucket.

  9. Create a CodeDeploy application and deployment group.

  10. Update the ECS task definition by adding another tag.

  11. Create a listener for the new port.

  12. Create a Lambda function for the AfterAllowTestTraffic event.

  13. Update the appspec.yml file.

  14. Modify the deployment group and add test listeners port.

  15. Check your final output in the CloudWatch log.

  16. Deleting AWS Resources.