September 27, 2018

September 26, 2018

LAB 8: AWS CI CD - Add Infra Source and Deploy for CloudFormation to Existing Pipeline

This Lab will focus on taking the pipeline you have created in Lab 5 Create a pipeline using AWS CodePipeline CodePipeline to the next level where you will spin-up the EC2 instance using CloudFormation Template and deploy the Java Web application on it.
get the source for spinning up EC2 from codecommit_infra_demo repo and create CodeDeploy application to deploy the CloudFormation template.

Login to AWS Console as `codedeploy_user`, go to AWS CodePipeline and edit the existing pipeline with the following configuration

Edit the Pipeline - codepipeline_demo

Add New ActionSource


Add New Deploy under Staging



Run the Pipeline


September 25, 2018

LAB 7: AWS CI CD Create Service Role for CloudFormation Deploy

In this Lab we will be creating a Service Role to spin-up an EC2 instance via Cloud Formation template

Login to AWS Console as `codedeploy_user` & go to AWS IAM dashboard -> Roles -> Create Role, select AWS Service as the type of trusted entity and proceed with the below configuration to create the role named codedeploy_cfn_role




LAB 6: AWS CI CD - Setup Infrastructure Repository in CodeCommit

AWS CI CD HomeLAB 6Setup Repository in CodeCommit (Similar to
Follow the instructions as in LAB 2: Setup Repository in AWS CodeCommit
Sample Infra Setup Code: https://github.com/bhuvana-s/CodeCommit_Infra_Demo
Git Repo in CodeCommit: codecommit_infra_demo

Now your CodeCommit will have two Repos - codecommit_demo and codecommit_infra_demo having the code replicated from 
Sample Infra Setup Code and Sample Java Web Application Code.

High Level Steps: 

  1. Login to AWS Console as `codedeploy_user` & go to AWS CodeCommit dashboard
  2. Create an empty repository ascodecommit_infra_demo and you may Skip SNS Topic as of now and view the Connect to your repository screen
  3. Get the Clone URL in your working directory
  4. Download the Sample Infra Setup Code from github to your working directory
  5. Push the changes to AWS CodeCommit

AWS CI CD - 2nd Workflow - Infrastructure Rollouts

2nd Workflow in AWS CI CD using AWS Developer Tools Lab Series is a continuation to 1st Workflow where the EC2 instance is spinned-up as part of AWS CodePipeline from CloudFormation template stored in AWS CodeCommit.

Infrastructure Rollout & Application Deployment

2nd Workflow is a continuation to 1st Workflow where the EC2 instance is spinned-up as part of AWS CodePipeline is CloudFormation template stored in AWS CodeCommit.

In the above network diagram, Java Web Application & Infrastructure Code are developed on-premise by two different teams, committed to two different repositories in AWS CodeCommit using Git Bash and the CodePipeline will have 3 stages with parallel actions in 1st stage & sequential actions 3rd stage.

  • First stage in the pipeline is to pull the source code from the Java Web Application & Infrastructure repositories in CodeCommit and pass on the Java Web App source code to AWS CodeBuild as an input artifact. Here both the actions as executed in parallel as there is no dependency.
  • 2nd stage is Build where CodeBuild compiles the source code, packages and stores the artifact in S3.
  • 3rd stage is Deploy which takes two input artifacts - Infrastructure Code & Java Web Application deployable artifact. Execution happens in two sequential actions
    • Infrastructure Code (i.e. CloudFormation template) from Stage 1 i.e. Source Stage is taken as input and Stack is created. 
    • CodeDeploy fetches the artifact from S3 and deploys to EC2 instance(s) that just got created.

         And your website can be accessed using the EC2 Endpoint or the public IP address.
  • update the inline policy for codedeploy_group with the content from https://github.com/bhuvana-s/aws_cicd_policydocs/blob/master/policy_codedeploy.json
    These additional permissions are required to create resources from CloudFormation Template.
  • LAB 6Setup Infrastructure Repository in CodeCommit
    Cross-verify the configurations defined in the LAB 6 against the below mind-map.
    Colour Codes: Green ones are created as part of LAB 6