AWS, Cloud Computing

3 Mins Read

How to Deploy Infrastructure using AWS Code Pipeline

AWS Code Pipeline: An overview

Are you eager to know how to Deploy Infrastructure with AWS Code Pipeline?AWS Code Pipeline is a Continuous Integration and Continuous Delivery service that can be used for fast and reliable infrastructure deployment and updates. It can automate and standardize the provisioning of the Infrastructure required to deploy your applications; Rapid Infrastructure modification can also be done whenever required with less human intervention. The Code Pipeline has multiple stages: source, build, and deploy. We will be deploying and modifying Infrastructure using CloudFormation templates for EC2 instances. 

Services for provisioning the Infrastructure

Below are the services we will be using to automate our Infrastructure provisioning.

CloudFormation– This service is used for deploying Infrastructure as a code. We will use two templates, one for initial deployment and another for updating the Infrastructure. During the Code Deploy stage, we will select CloudFormation Stack to provision the resources defined in the template.


Simple Storage Service (S3) – The CloudFormation template would be uploaded and stored in an S3 bucket. This bucket would be used as a source while creating Code Pipeline.


Code Pipeline- We will build an automated process for provisioning and updating our Infrastructure using this service.

Customized Cloud Solutions to Drive your Business Success

  • Cloud Migration
  • Devops
  • AIML & IoT
Know More

Steps to create a Code Pipeline for Infrastructure Deployment.

Below are the steps to follow;

Pre-requisites: Two CloudFormation templates (One template to create an EC2 instance with one Elastic IP and a Security group associated with it. Second template with some modifications in the security group rules)

Execution Steps-

  1. In the AWS console, open the S3 service and create a bucket with versioning enabled.
  2. Zip both the CloudFormation templates and upload the first template to the bucket. (Remember the name of the Zip file uploaded in a bucket and also the name of the template with the extension present within that zip file (e.g., zip, which consists of a template named ec2.yaml)
  3. Now open the Code Pipeline console page.
  4. Click on the ‘Create Pipeline’
  5. Enter the name for the pipeline, keep all values as default (as shown in Figure 1.1), and then click ‘Next.’

Deploy AWS Code Pipeline-step-1


  1. On the Source Stage page, select the Source Provider as ‘Amazon S3’. Then select the bucket created in earlier steps, provide the zip file name (as shown in Figure 1.2), and click ‘Next.’


  2. On the Build Stage page, Click on ‘Skip Build stage’ and then click on ‘Skip’
  3. Now, on the Deploy stage, select Deploy provider as ‘AWS CloudFormation’ and enter other information as shown in Figure 1.3 (the yaml is the template within the zip file in the S3 bucket). Select the ‘local execution role’ and then click ‘Next.’
  4. Review and Click on ‘Create Pipeline’


  5. This step will deploy the EC2 instance using the Code Pipeline service. Once the deployment, it will show the success of stages, as shown in Figure 1.4


Updating the deployed Infrastructure

To update the existing Infrastructure deployed using the Code Pipeline service, follow the below-given steps.

  • Create a zip file of a modified template file with the same file name as zip.
  • Upload the updated zip file in the same source bucket selected earlier while creating the pipeline.
  • Observe the pipeline for the update process. (As shown in figure 1.5)
  • Once the update is successful, observe the changes in the EC2 security groups.



Thus, we can conclude that with how to deploy Infrastructure with AWS Code Pipeline or provision your Infrastructure quickly and reliably using the CI/CD process, then we can use the Code Pipeline service.

You can read more about AWS Code Pipeline from official AWS site.

Get your new hires billable within 1-60 days. Experience our Capability Development Framework today.

  • Cloud Training
  • Customized Training
  • Experiential Learning
Read More

About CloudThat

CloudThat is a cloud-agnostic organization. We are an AWS Advanced Consulting Partner, Microsoft Solutions Partner, Training Partner, Google Cloud Partner, and VMware Training Reseller, empowering organizations and professionals with cloud skills. We are on a mission to build a robust cloud computing ecosystem by disseminating knowledge on technological intricacies within the cloud space. Our blogs, webinars, case studies, and white papers enable all the stakeholders in the cloud computing sphere.

You can learn more about our consulting and training offerings from our website.

WRITTEN BY Abhijit Dilip Powar



    Click to Comment

Get The Most Out Of Us

Our support doesn't end here. We have monthly newsletters, study guides, practice questions, and more to assist you in upgrading your cloud career. Subscribe to get them all!