Create a pipeline in AWS Regions that don’t support AWS CodePipeline
Created by Anand Krishna Varanasi (AWS)
Code repository: invisible-codepipeline-unsupported-regions | Environment: PoC or pilot | Technologies: Infrastructure; DevOps |
AWS services: AWS CodeBuild; AWS CodeCommit; AWS CodeDeploy; AWS CodePipeline |
Summary
AWS CodePipeline is a continuous delivery (CD) orchestration service that’s part of a set of DevOps tools from Amazon Web Services (AWS). It integrates with a large variety of sources (such as version control systems and storage solutions), continuous integration (CI) products and services from AWS and AWS Partners, and open-source products to provide an end-to-end workflow service for fast application and infrastructure deployments.
However, CodePipeline isn’t supported in all AWS Regions, and it’s useful to have an invisible orchestrator that connects AWS CI/CD services. This pattern describes how to implement an end-to-end workflow pipeline in AWS Regions where CodePipeline isn’t yet supported by using AWS CI/CD services such as AWS CodeCommit, AWS CodeBuild, and AWS CodeDeploy.
Prerequisites and limitations
Prerequisites
An active AWS account
AWS Cloud Development Kit (AWS CDK) CLI version 2.28 or later
Architecture
Target technology stack
The following diagram shows a pipeline that was created in a Region that doesn’t support CodePipeline, such as the Africa (Cape Town) Region. A developer pushes the CodeDeploy configuration files (also called deployment lifecycle hook scripts) to the Git repository that’s hosted by CodeCommit. (See the GitHub repository
The CodeDeploy configuration files are fetched from CodeCommit as part of the source stage of the pipeline and transferred to CodeBuild.
In the next phase, CodeBuild performs these tasks:
Downloads the application source code TAR file. You can configure the name of this file by using Parameter Store, a capability of AWS Systems Manager.
Downloads the CodeDeploy configuration files.
Creates a combined archive of application source code and CodeDeploy configuration files that are specific to the application type.
Initiates CodeDeploy deployment to an Amazon Elastic Compute Cloud (Amazon EC2) instance by using the combined archive.
![Pipeline creation in unsupported AWS Region](/images/prescriptive-guidance/latest/patterns/images/pattern-img/e27750de-b597-424e-b5bf-4d58dc9b60cc/images/95fc815e-a762-4142-b0fd-2a716823e498.png)
Tools
AWS services
AWS CodeBuild is a fully managed build service that helps you compile source code, run unit tests, and produce artifacts that are ready to deploy.
AWS CodeCommit is a version control service that helps you privately store and manage Git repositories, without needing to manage your own source control system.
AWS CodeDeploy automates deployments to Amazon EC2 or on-premises instances, AWS Lambda functions, or Amazon Elastic Container Service (Amazon ECS) services.
AWS CodePipeline helps you quickly model and configure the different stages of a software release and automate the steps required to release software changes continuously.
AWS Cloud Development Kit (AWS CDK) is a software development framework that helps you define and provision AWS Cloud infrastructure in code.
Code
The code for this pattern is available in the GitHub CodePipeline Unsupported Regions
Epics
Task | Description | Skills required |
---|---|---|
Install the AWS CDK CLI. | For instructions, see the AWS CDK documentation. | AWS DevOps |
Install a Git client. | To create commits, you can use a Git client installed on your local computer, and then push your commits to the CodeCommit repository. To set up CodeCommit with your Git client, see the CodeCommit documentation. | AWS DevOps |
Install npm. | Install the npm package manager. For more information, see the npm documentation | AWS DevOps |
Task | Description | Skills required |
---|---|---|
Clone the code repository. | Clone the GitHub CodePipeline Unsupported Regions
| DevOps engineer |
Set parameters in cdk.json. | Open the
where:
| AWS DevOps |
Set up the AWS CDK construct library. | In the cloned GitHub repository, use the following commands to install the AWS CDK construct library, build your application, and synthesize to generate the AWS CloudFormation template for the application.
| AWS DevOps |
Deploy the sample AWS CDK application. | Deploy the code by running the following command in an unsupported Region (such as
| AWS DevOps |
Task | Description | Skills required |
---|---|---|
Set up CI/CD for the application. | Clone the CodeCommit repository that you specified in the
where the repository name and Region depend on the values you provided in the | AWS DevOps |
Task | Description | Skills required |
---|---|---|
Test the pipeline with deployment instructions. | The | AWS DevOps |
Related resources
Getting started (AWS CDK documentation)
Introduction to the Cloud Development Kit (CDK)
(AWS Workshop Studio)