Deploying Application CodeCommit, CodeDeploy&CodePipeline
Deploying Application CodeCommit, CodeDeploy&CodePipeline
SL Topic Page No
1 Git 4
2 CodeCommit 9
2.7 Creating config file in Git Bash & Verify Codecommit connection 22
3 CodeDeploy 26
4 Codepipeline 43
● AWS Account
● AWS EC2 Fundamental Knowledge
● AWS S3 Fundamental Knowledge
● AWS IAM Fundamental Knowledge
● Developer Tools on AWS Fundamental Knowledge
● Git Fundamental Knowledge
● Linux Fundamental Knowledge
● YAML Fundamental Knowledge
Services used
💠 Topic Page No
Overview :
Step -2 : Install Chocolatey : Open the below weblink for the documentation
🔗 https://chocolatey.org/install#individual
Step - 4 : Install git : Run command the below command in powershell to install git
📋 choco install git -y
Git is a version control tool and source code management tool, to handle the code changes
and for uploading code from your pc to cloud repository we effectively use the git
We have a web application source code in a git repository , we need to download the code
from git repository using git clone and in next steps we upload this code to CodeCommit
repository for Implementing CICD for this project
Step -1 > Github Repository : visit the github repository using below link and copy the HTTPS
clone link at github repository
📋 https://github.com/SagarFive/explore-world-bootstrap-website.git
Step-2 > Open Git Bash, Change your working directory to Desktop and Clone the project
using the previously copied link
📋 cd Desktop/
💠 Topic Page No
2.7 Creating config file in Git Bash & Verify Codecommit connection 23
2.8 Pushing the code to Codecommit & Verifying the code at codecommit 25
Repository
Step - 1 > Login with your IAM Account(with Administrator Access) is Recommended
🔗AWS Login URL https://console.aws.amazon.com/console/home?nc2=h_ct&src=header-signin
Or if you don’t have an IAM Account or AWS Account , Create it by using below documentation.
Step 1 - Open CodeCommit: Search for CodeCommit at AWS Search Bar and open/select it
Step - 3 - Create repository : Enter Repository name , Description and tags and click on Create
Step 1 - Connection Steps : Once, after the CodeCommit repository is created, it will show the
below dashboard/page. Click on SSH and select your Operating system(in my case windows)
And we need to follow the below instructions to connect/upload with your local git repository
Overview :
Step 4 - Specify user details : Enter User name and Click on Next
When after clicking on Create policy , new tab opens with Create policy page
Step 7 - Add ARN : Add Region(Which region CodeCommit Repository Created) , Account(auto
updates) and Repository name : copy and paste the CodeCommit Repository name and next click
on Add
When after clicking, policy generated, redirects to policy page , there we can we see the newly
created policy
Step 10 - Attach policy to IAM user : Get back to IAM Creation tab, click on refresh the permission
icon , next search for newly created policy , select and attach policy to IAM user
When after clicking Create user, Redirects users page and show newly created username in the
list,click on the user
Step 12 - Copy the SSH public key: Read the public key using above information
Your public key has been saved in : /c/Users/sagar/.ssh/P1-ExploreWorld_CodeCommit-SSH-key.pub
📋 Command cat /c/Users/sagar/.ssh/P1-ExploreWorld_CodeCommit-SSH-key.pub
Step 1 - Go to SSH public keys for AWS CodeCommit (0) : (Follow 2.4 , step-11 to reach) ,
Click on Upload SSH Public key
Step 2 - Upload SSH Public key : Paste the key at input box and click on Upload SSH Public key
Step 3 - Copy SSH Key ID : Next page automatically redirect to users page, shows success status
(i) Overview:
Step 1 -Open Git bash : Run the below commands to create config file in ssh directory
📋 Command to enter/move into ssh directory cd .ssh
Step 2 - Enter config file data : Follow step 3 of connections instruction and enter your
data(replace with your information)
📋 User Refer 2.6 > Step 3 - Copy SSH Key ID
📋 IdentityFile(Private key name) Refere 2.5 > Step 1 - Generating Token > Your Identification Saved in
Once this panel opens, Press I (to wire data), and Press ESC next Enter wq! To save the data
.
.
.
.
📋 Commit the changes with name git commit -m “Update Local Repository @ 05-02-2023-0902pm”
👍Open the repository and Now you can see the updated code At AWS CodeCommit Repository
💠 Topic Page No
Step 2 - Create Application : Click on Applications on Sidebar , Next Click on Create application
📋
Deployment
Deployment group contains instances to add the deployment(means web server files), It includes
● Amazon EC2 Auto Scaling groups
Group ● Amazon EC2 instances
● On-premises instances
So we need a Create an EC2 instance for web server
💠Note : Let’s Create an EC2 Instance with S3 ReadOnly Access Role(for retrieving the web server
files)
(ii) Instance type : t2.micro (1GB RAM - 1 Core CPU - Free Tier eligible)
(iii) Key pair : It’s a SSH key (It’s used to enable password less logins)
● New → Name ,
● Keypair type=RSA ,
● Private key file Format=.pem
(v) Advanced settings : Scroll down and add userdata for CodeDeploy Agent installation
CodeDeploy Agent needs to be installed on the machine to handle the CodeDeploy operations
Once after clicking on Launch Instance , It will show the Success dialogue , click on blue color
instance id in dialogue box
Next we need to attach S3ReadonlyAccess Role from grabbing web server files from it
tags <your-tags>
Once after clicking on Create role , it will shows you success info, you can click on view role for
further information if you want to explore
Modify IAM role : Search for role and select it , Next click on Update IAM role
tags <your-tags>
(v) Agent configuration with AWS Install AWS CodeDeploy Agent : Select Never
💠 Topic Page No
Steps
Region : N.Virginia
Step 1 -Check the pipeline : Open the pipeline : Pipeline already started working & shows you the
status
📝 cd /var/log/aws/codedeploy-agent
📝 ls
📝 cat codedeploy-agent.log
You can see it downloaded code from codebuild repo source and deployed to Deployment group
server by using commit changes
Step 9 - CICD Auto Deployment : When you refresh the page, we can see the Thanks for visiting in
the footer, means when we commit the changes Codepipeline automatically deploy the changes to
server
It’s Done ! Creating CICD pipeline using AWS Developers Tools like CodeCommit , CodeDeploy
and CodePipeline.
Thank you !