DEV Community

Revathi Joshi for AWS Community Builders

Posted on

3-part series - (3) Create a CodePipeline pipeline and deploy the application on the instance

In this 3-part series on Create and Deploy applications using CodeDeploy and CodePipeline with Amazon S3 bucket versioning enabled -

In the 3rd article, we will create a CodePipeline pipeline and deploy the application on the instance

1st article

2nd article

Let’s get started!

Please visit my GitHub Repository for CI-CD/Docker/ECS/ECR articles on various topics being updated on constant basis.

Objectives:

1. Create a CodePipeline pipeline and deploy the application on the instance

2. Test the application using EC2 Instance Public IPv4 DNS

3. Delete all the following services

Pre-requisites:

  • AWS user account with admin access, not a root account.
  • AWS CLI.

Resources Used:

CodeCommit

CodeBuild

CodeDeploy

AWS CodePipeline

Steps for implementation to this project

1. Create a CodePipeline pipeline and deploy the application on the instance

  • on CodePipeline under Developer Tools, Pipelines, Create pipeline, my_codepipeline, Service role: New service role, AWSCodePipelineServiceRole-us-east-1-my_codepipeline, Next

Image description

Add S3 policy to the role created by Codepipeline

  • On the IAM console, Roles, search and click for the role starting with AWSCodePipelineServiceRole-us-east-1-my-codepipeline which was created with the codepipeline, On the Permissions tab, Add permissions, Attach policies, Search and select AmazonS3FullAccess, Attach policies

  • Expand the option of Advanced settings, Artifact store: Custom location, Bucket: codecommit-bucket12

  • Next

Image description

1. Add Source stage

  • Source provider : Choose Source provider: Amazon S3, Bucket: codecommit-bucket12, S3 object key: App_Linux.zip

  • Next

Image description

2. Add build stage

Skip build stage

  • Next

Image description

  • Skip

3. Add deploy stage

Deploy provider : AWS CodeDeploy, Region: US East (N. Virginia), Application name: my-codedeployapp, Deployment group: my-codedeploy-grp

  • Next

Image description

  • Review and Create Pipeline.

  • CodePipeline has started to run and will succeed.

  • Wait for 4-5 minutes to succeed

Image description

Image description

2. Test the application using EC2 Instance Public IPv4 DNS

  • Copy the Public IPv4 DNS of the Instance.

Image description

3. Delete all the following services

  • EC2 Instance

  • CodeDeploy Application

  • CodePipeline

  • AWSCodePipelineServiceRole-us-east-1-my_codepipeline

  • S3 Bucket

  • HTTPS Git credentials for AWS CodeCommit

What we have done so far

  • We have successfully created and deployed applications using CodeDeploy and CodePipeline with Amazon S3 bucket versioning enabled

Top comments (0)