/aws-refarch-cross-account-pipeline

The Cloudformation Templates guides the users to setup a codepipeline in Account-A, CodeCommit in Account-B and Deployment of a Sample Lambda in Account-C. Provides a reference for customers to use AWS CodePipeline as a centralized product to enable CI/CD across multiple accounts.

Primary LanguageShellApache License 2.0Apache-2.0

Reference Architecture: Cross Account AWS CodePipeline

This reference architecture demonstrates how to push code hosted in AWS CodeCommit repository in Development Account, use AWS CodeBuild to do application build, store the output artifacts in S3Bucket and deploy these artifacts to Test and Production Accounts using AWS CloudFormation. This orchestration of code movement from code checkin to deployment is securely handled by AWS CodePipeline.

[][architecture]

Running the example

1. Clone the sample Lambda function GitHub repository

Clone the AWS LAMBDA sample application GitHub repository.

From your terminal application, execute the following command:

git clone https://github.com/awslabs/aws-pipeline-to-service-catalog.git

This creates a directory named aws-pipeline-to-service-catalog in your current directory, which contains the code for the AWS Lambda function sample application.

2. Create AWS CodeCommit repository in Development Account

Follow the instructions here to create a CodeCommit repository in the Development Account.Name your repository as sample-lambda

Alternatively, from your terminal application, execute the following command. You may refer here on further details, in order to setup AWS Cli , if required.

aws codecommit create-repository --repository-name sample-lambda --repository-description "Sample Lambda Function"

Note the cloneUrlHttp URL in the response from above CLI.

3. Add a new remote

From your terminal application, execute the following command:

git remote add AWSCodeCommit HTTP_CLONE_URL_FROM_STEP_2

Follow the instructions here for local git setup required to push code to CodeCommit repository.

4. Push the code AWS CodeCommit

From your terminal application, execute the following command:

git push AWSCodeCommit master