AWS ECS and GitHub integration

Amazon Elastic Container Service (Amazon ECS) is a fully managed container orchestration service that makes it easy to operate containerized workloads at scale. It also integrates with other core AWS services, such as Amazon Route 53, AWS Identity and Access Management (IAM), and Amazon CloudWatch. Establishing an effective and efficient CI/CD pipeline is critical for containerized applications, regardless of the platform you are using to manage your containers.

AWS has posted an interesting blog, where a pattern to deploy a CICD for applications deployed on ECS is presented, including code.  The blog also illustrates how AWS CodeBuild can be used with GitHub Actions to execute application tests as part of a complete CI/CD pipeline.

Some key take-aways:

To build the architecture described in the solution overview, you will need the following ECS components:

  • ECR Repository: store versioned application container images
  • ECS Cluster: provides compute power to run application container instances
  • ECS Task Definition: specifies application container image version and environment considerations
  • ECS Service: specifies how task definition will be deployed onto underlying compute resources

To build this infrastructure, use the AWS Cloud Development Kit (CDK).

For organizations using GitHub as a source code repository, GitHub Actions provide a way to implement complex CI/CD functionality directly in GitHub by initiating a workflow on any GitHub event.

AWS CodeBuild supports webhooks when GitHub is used as the source code repository.  This allows CodeBuild to work with source code stored in GitHub, and use webhooks to trigger a build of the source code every time a code change is pushed to the GitHub repository.