Before diving into the AWS CodePipeline service, we must first understand CI/CD pipelines. A
To set up CI/CD pipelines on AWS, we use Amazon’s CodePipeline service. This fully managed, continuous delivery service helps developers automate their release pipelines for quick and reliable developmental changes to their cloud infrastructure.
CodePipeline enables the rapid and reliable delivery of new features and updates. Moreover, it is simple to integrate AWS CodePipeline with Amazon’s own web services like CodeCommit or third-party services like GitHub.
Here’s an example of a typical CI/CD pipeline made using AWS CodePipeline:
The CodePipeline CI/CD pipeline example above comprises the following three stages:
Source: This is the first stage in the pipeline, where the pipeline retrieves the application’s source code from a third-party service like GitHub for hosting code and version control. This stage is triggered when CodePipeline automatically detects any code changes developers commit to the GitHub repository.
Build: This is the second stage in the pipeline, where the committed code is usually built by Amazon’s CodeBuild service and managed by CodePipeline. Under the hood, CodeBuild will compile and package the retrieved source code into a deployable application and run unit tests on it, if any.
Test: This is the third stage in the pipeline, where unit tests are run on the built application, if there are any. Depending on how those tests are configured, these tests are usually carried out by either Amazon’s CodeBuild or CodeDeploy services.
Staging: The fourth stage in the pipeline, where the build application is deployed to a staging environment for testing. Usually, this staging environment is made up of EC2 instances, while CodeDeploy manages the whole stage. In some cases, manual approval might be required after all tests have been done before deploying the application to the production environment.
Production: This is the final stage, where the application is moved from the staging environment and finally hosted in the production environment made up of EC2 instances on Amazon.
All stages above are inside the pipeline managed by CodePipeline. However, this whole CI/CD pipeline is completed when users of the deployed production application provide feedback to developers of the application, who then push code changes based on their suggestions to the code repository.
For more information, visit the official AWS documentation on CodePipeline here.