0% found this document useful (0 votes)
36 views30 pages

How To Setup Auto-Deployment Using Codepipeline and Codedeploy

Uploaded by

hemanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
36 views30 pages

How To Setup Auto-Deployment Using Codepipeline and Codedeploy

Uploaded by

hemanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 30

How to Setup Auto-Deployment using CodePipeline

and CodeDeploy

Workflow:-

Create an IAM Role for CodeDeploy:


Choose AWS service in Trusted entity types and choose
CodeDeploy in the Use cases section and proceed to the
next step.

Now, you can see that the AWSCodeDeployRole policy


is the only policy available, and it'll be chosen by default
in this (Permissions) step.
Enter a name for your IAM role. You should choose a
meaningful name to identify this in the future. I'm calling
it service-role-for-code-deploy.

Create an IAM role for EC2


Let's create the next role. This role is for EC2. Choose
AWS service in the Trusted entity type, EC2 in the
Common use cases section, and choose CodeDeploy in
Use cases for
other AWS services.

search for codedeploy


select "AmazonEC2RoleForCodeDeploy"

Launch Ec2 Instance


Connect Ec2 instance

copy ssh key

open git bash , putty


set hostname
$sudo yum install hostnamectl set-hostname localmachine
$sudo -i

install git
$yum install git -y
How to create Repository:
Open Aws CodeCommit
select create repository

Next conncetion steps


open Linux

open git bash check id_rsa.pub key


generate ssh-key
Step 2: Register SSH Public Key
$ssh-keygen

copy id_rsa.pub key


Go to IAM select user
select security credentials

upload ssh public key(id_rsa.pub key)

Step 3: Edit Local SSH Configuration


Edit your SSH configuration file named "config" in your
local ~/.ssh directory. Add the following lines to the file,
where the value for User is the SSH Key ID you copied in
Step 2.
$vi ~/.ssh/config
Host git-
codecommit.*.amazonaws.com User
Your-IAM-SSH-Key-ID-Here
IdentityFile ~/.ssh/Your-Private-Key-File-Name-Here

Step 4: Clone the repository


$mkdir project
$cd project
$mkdir codecommit
$cd Codecommit
$git clone ssh://git-codecommit.us-east-
1.amazonaws.com/v1/repos/myrepo23

$ls -al
$cd myrepo23

$vi appspec.yml
$vi index.html

$mkdir scripts
$vi scripts/install_dependencies
$vi scripts/start_server

$vi scripts/stop_server

$ls -al
$git add .
$git config --global user.email " @gmail.com"
$git config --global user.name "your name"
$git commit -m "first commit" -a
$git push origin master
Login into another aws Ec2 instance (for
application deploy):-
consider as a node

Attach the IAM Role to EC2

Update IAM role


Connect node

$sudo hostnamectl set-hostname node


$sudo -i
Install codedeploy-agent:-
$ sudo yum update
$sudo yum install ruby
$sudo yum install wget
$cd /home/ec2-user
$wget https://aws-codedeploy-us-east-
1.s3.amazonaws.com/latest/install
$chmod +x ./install
$sudo ./install auto
$sudo service codedeploy-agent start
$sudo service codedeploy-gent status

How to Create the CodeDeploy Application:-


In the AWS Console, search "CodeDeploy" in the search bar at the
top. Select "Applications" in the left pane. Click on the "Create
application" button on the top right.
create deployment group
In the Environment configuration section, select "Amazon EC2
instances" and select the key as Name. Enter your EC2 instance
name in the value.
select Create deployment group
How to Create the CodePipeline:-

Enter the Pipeline name, and Role name. Remember, we


created roles for EC2 and CodeDeploy, but not for CodePipeline.
AWS by default creates it from here.
Select Next

Select Next
select next

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy