September 9, 2018

AWS Developer Tools - CI CD LAB Series

Welcome to the home for CI CD Lab Series using AWS Developer Tools!

When Vijaya Nirmala.G & myself planned to co-present a talk on CI CD Lab using AWS Developer Tools @ 2nd Edition of AWS Community Day Bengaluru 2018 organized by AWS User Group Bengaluru,  many use cases around AWS Developer Tools / Code Services flashed, wondering what to talk, where to start & when to stop.

Since it sounded little difficult to put the vast knowledge within the short duration, decided to coherently sketch them as a blog with hands-on lab and then extract the essence of it with the fresh experience to present it Cloud enthusiasts.

Introduction



Here you go with the well designed Lab Series!

We will be focusing on three most important streams where AWS CI CD is essential and constructed as 3 workflows in this 13 LAB Series
  1. Web Application Deployments
  2. Infrastructure Rollouts
  3. Serverless Application Deployments 

What will I learn in this Lab Series ?

You will learn the following that are bare minimum requirement for this Lab Series
  • Creating IAM Group by attaching existing policies and defining in-line policies
  • Create IAM User & Service Role
  • Create S3 Bucket
  • Create a repo in AWS CodeCommit, add source & commit the changeset
  • Build Sample Java Application using AWS CodeBuild, taking source from CodeCommit
  • Create Security Group, Instance Profile Role, EC2 Instance from console
  • Create CodeDeploy to install pre-requisites & deploy Java Web Application
  • Create CodeDeploy to spin-up EC2 instance & deploy Java Web Application
  • Create & Execute CloudFormation template to create lambda function
  • Create AWS CodePipeline to glue AWS CodeCommit, AWS CodeBuild, AWS CodeDeploy 
  • Integrating Manual Approval with AWS CodePipeline

Disclaimer: 

  • Note that the entire AWS Developer Tools - CI CD LAB have been created validated both by myself & Vijaya Nirmala.G.  Feel free to add comments, if you find any issues.
  • Though this LAB material will cover the AWS resources very well within your monthly free limits, ensure to tear down the unused resources to avoid surprises.
    • AWS CodeCommit: Anyone with an AWS account can get started with AWS CodeCommit for free. Your account gets 5 active users per month for free (within limits), after which you pay $1 per additional active user per month. There are no upfront fees or commitments.
    • AWS CodeBuild: Only pay by minute for the compute resources you use
    • AWS CodeDeploy: There is no additional charge for code deployments to Amazon EC2 instances through AWS CodeDeploy. You pay $0.02 per on-premises instance update using AWS CodeDeploy.
    • AWS CodePipeline: You pay only for what you use. AWS CodePipeline costs $1 per active pipeline* per month. To encourage experimentation, pipelines are free for the first 30 days after creation.

Here is the Reference Link to the resources used in this Lab Series

Happy to share the stage with Nirmala!
Have been a wonderful learning throughout the journey...



September 7, 2018

Solved: CodeDeploy - `Exiting on User Command`

As part of CI CD Setup using AWS Developer Tools, have pulled the source code of a hello-world java application from CodeCommit, compiled & packaged using CodeBuild and artifacted to S3 in zip format (hello-world-zip).

Later create CodeDeployDemo application where BeforeInstall phase have been configured to invoke a shell script (say install_dependencies) to install & configure Java & Tomcat.

Well coded & tested script but failed to see some devil in the details

Excerpt from install_dependencies
# Install Java if not yet installed
{ which java; } || { yum install java; }

While installing Java, it failed to with the message Exiting on User Command while looking for input to Is this ok [y/d/N]:


modified the script as mentioned below skip user inputs and could go past the BeforeInstall phase successfully.
# Install Java if not yet installed
{ which java; } || { yum install java -y; }

September 6, 2018

Preview Tool on Mac to Mask PII on Medical Reports

Preview Tool came really handy when there was a need to mask Personally Identifiable Information on a pdf file, especially when I had to share someone's medical report on the web for a social cause.

Open the pdf file in Preview tool on mac, go to Tools -> Annotate -> Rectangle, place on the text to be masked on the pdf document and change the colour of your choice from the colour palette.

Save and take the PII masked file forward.

Inspirational & Influential Experiences

Tamil

பாலவிஹாரின் கோடைகால முகாம்!

கல்லூரி கனவலைகள்!

சிறுதானியத்தின் சிறப்பு


English

Sunshine

Rainy Day

Letter to Sharvesh on his 12th Birthday

September 5, 2018

Solved: CodeDeploy & S3 - `The specified key does not exist`

As part of CI CD Setup using AWS Developer Tools, have pulled the source code from CodeCommit, compiled & packaged using CodeBuild and artifacted to S3 in zip format (hello-world-zip).

Please note that the file gets stored in S3 only as hello-world (https://s3.amazonaws.com/<bucketname>/hello-world) without extension

Later, I had created CodeDeploy Application & Deployment Group with the following settings
  • Repository Type -> My application is stored in Amazon S3 
  • Revision Location -> s3://<bucketname>/hello-world.zip 
  • Supported file type was automatically selected as zip
  • Content Options -> Overwrite the content 
  • Rollback configuration overrides -> Roll back when a deployment fails


Running Deploy fails at DownloadBundle throwing `The specified key does not exist`



Again went to Deploy New Revision, changed the below settings and it has gone past DownloadBundle without any issue
  • Revision Location -> s3://<bucketname>/hello-world
  • Supported file type was _explicitly_ entered as zip (otherwise it will say unsupported)