Monday, 11 September 2023

Create an automated software release pipeline (CI/CD pipeline) using AWS CodePipeline.

 Create an automated software release pipeline (CI/CD pipeline) using AWS CodePipeline.


Tutorial Objectives:

1. Learn to deploy your code every time there is a code change using AWS CodePipeline.

2. Learn to use an Amazon Simple Storage Service (S3) bucket as a source code repository.

3. Learn to automate the software release process by continuous deployment of application code revisions.


Prerequisite: Download the required zip file (CI_CD.zip) from here.


Step 1: Open the AWS tab and go to S3 console.

Click on Create bucket.


Bucket name: mybucketforcpp

Select AWS region of your choice. Here it is US West (N.California)us-west-1


Uncheck the box for Block all public access and click on I Acknowledge.


EnableBucket Versioning.


Click Create bucket.


Click on bucket created.


Upload the version 1 zip file from your local machine.


After clicking on v1 file below zip file will be opened which we have to upload as version 1.


Click Upload.


Store the below Object URL and Key for further use as shown below.


Step 2: Go to Elastic Beanstalk service. Click on Create Application.


Application name: mycppapp


Platform: PHP

Platform branch: PHP 8.0 running on 64bit Amazon Linux 2

Platform version: 3.3.6 (Recommended)


Click on Upload your code.


Source code origin: Public S3 URL

Add Object URL which we stored in previous step after creating S3 bucket.

Click Create Application.

This will create an environment which is shown below.


After the creation of the environment click on the link shown in below image.


This will give you Version 1 as shown below.


Step 3: Go to CodePipeline Service in the new tab.

Click on Create pipeline.


Pipeline name: MyPipeline

Service Role: New service role

Click Next.


Source provider: Amazon S3

Bucket: mybucketforcpp

Copy and paste S3 object key which we previously stored.

Click Next.


Click on Skip build stage.


Deploy provider: AWS Elastic Beanstalk

Region: US West (N.California). The region in which S3 bucket is created and region for Elastic Beanstalk should be same.

Application name: mycppapp

Environment name: Mycppapp-env

Click Next.


Click Create pipeline.


Pipeline is being Deployed which is in progress as shown in blue colour below. Once it is deployed the colour turns to green.



Go to S3 bucket and upload V2 zip file in bucket as we did for version 1. Follow step 1.


Go back to Elastic Beanstalk tab and refresh the page and click on the link shown in below image.


This will give us Version 2 as shown below.


Step 4: Go back to CodePipeline created and click on Edit.


Click Add Stage in between Source and Deploy.


Stage name: MyReview. Click Add stage.


Click Add action group.


Action name: ManualReview

Action provider: Manual approval


Click Done.


Click Save.



Go back to S3 bucket and upload V3 zip file same as shown in step 1.


ManualReviewis waiting for approval as shown in blue colour below.


Once approval completes it will be indicated by green colour.

Click on Review.


Write comment as This is Ok.

Click Approve.


So now Approval is completed which is shown in green colour.


Step 5: Go back to Elastic Beanstalk tab.

Refresh Page.

Click on the link shown in below image.


This will give you version 3 as shown below.