How to Configure Codedeploy Part 1 on Aws


Today, We will learn How to configure and install CodeDeploy Service in Aws. Now a days, Web Development Company want to Automatic Deploy there Code form Like :- Git Server, Github, Code Commit Service of AWS, SVN etc...

So Please follow the Step by Step of Create Code Deploy Service :-    

1. Login AWS Console and Go to IAM Service :-

  • Click Role =>  Click Create Role => Select EC2 instance => Click Review
  • Role Name => Click Create Role

2. Create Poliy for the Role :-
  • Click Policies => Create Policy => Click JSON Tab => Past Below Code.
  • Review Policy => Give the Policy Name => Create Policy
{  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "autoscaling:PutLifecycleHook",
        "autoscaling:DeleteLifecycleHook",
        "autoscaling:RecordLifecycleActionHeartbeat",
        "autoscaling:CompleteLifecycleAction",
        "autoscaling:DescribeAutoscalingGroups",
        "autoscaling:PutInstanceInStandby",
        "autoscaling:PutInstanceInService",
        "ec2:Describe*"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}
3. Attach the Policy to Role Which We Created :-

  • Select Role => Click Attach Polices => Search your Policy Name and Attach it =>


4. Go To Trust Relationship :-

  • Cliect Trust Relationship => Edit Trust Relationship => Remove this one and Past Below Code =>
  • Update Trust Policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "",
      "Effect": "Allow",
      "Principal": {
        "Service": [
          "codedeploy.ap-south-1.amazonaws.com",
          "codedeploy.us-east-1.amazonaws.com"
        ]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
5. Now, Create One more Role and Policy with for EC2 Instance :-

  • Same Step Above but Policy Code is Below
{ 
    "Version": "2012-10-17", 
    "Statement": [   
      {     
          "Action": [       
              "s3:Get*",       
              "s3:List*"     
          ],     
          "Effect": "Allow",     
          "Resource": "*"   
      } 
    ]
}


6. There are two types of  attach the Role :-
1. Go to EC2 Service, Create New EC2 Instance and Select the Role form IAM Role :-
2. Your EC2 Instance Server is Already Running.

  • Select the Server which you want to Attach Role => Action Tab => Instance Setting =>  Attach/Replace IAM Role

7. There are two type of Installation Codedeploy Agent in EC2 Instance :-
1. Go to EC2 Service, Create New EC2 Instance and Click Advance Details Tab.

2. Login to Running Instance and Run Below Commands :-
sudo yum update
sudo yum install ruby wget
cd /home/ec2-user
sudo wget https://aws-codedeploy-ap-south-1.s3.amazonaws.com/latest/install
sudo chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent start

Note :- Bucket name is that name where is your EC2 instance region. For example,
My Instance is running on region=ap-south-1 command should be (wget https://aws-codedeploy-ap-south-1.s3.amazonaws.com/latest/install). You can change as per your EC2 Instance Codedeploy Server region.

Please Click here for Second Part 2 of CodeDeploy

How to Configure Codedeploy Part 1 on Aws How to Configure Codedeploy Part 1 on Aws Reviewed by Unknown on September 29, 2018 Rating: 5

No comments:

Scribe

http://feeds.feedburner.com/LinuxAndAws
Powered by Blogger.
X

Get Updates On

Linux Tutorial

AWS Tutorial

Devops Tutorial

We are going to send you our resources for free. To collect your copy at first, join our mailing list. So don't miss any updates, stay connected!