API Star with AWS Codepipeline

GitHub  

Overview

API Star is a lighting fast API framework in Python. AWS Codepipeline will be used to deploy the code as mentioned above. Although API Star is used here, the script can be easily converted to other frameworks since the application is dockerized.

Pipeline

GitHub -> AWS CodeBuild -> AWS ElasticContainerRepository -> AWS CodeDeploy

Summary

The code committed to GitHub should trigger AWS CodePipeline to bundle the source code and send to AWS CodeBuild. The AWS CodeBuild looks for a file named buildspec.yml at the root level of the repository. This file provides CodeBuild instructions of how to build the code. CodeBuild builds docker image and push the image to AWS ElasticContainerRepository(ECR). In the last section of buildspec.yml, the artifacts gives CodeBuild instruction to save the scripts and send to AWS CodeDeploy for retrieving docker image from ECR. CodeDeploy will receive the zip file containing appspec.yml at root level. CodeDeploy will then use instructions from appspec.yml to get the new docker image up on EC2 instances.