Skip to content
Menu
myCloud myCloud

Personal short notes about Cloud

  • XMPie
  • AWS
    • AWS Topics
    • AWS Architecture
    • AWS CLI
    • AWS Health
    • AWS Policies
    • AWS Cost
  • CHEAT SHEETS
myCloud myCloud

Personal short notes about Cloud

AWS Code Deploy

By mikado on October 23, 2022
  1. Launch EC2 instance with IAM policy to read S3
  1. Installing the CodeDeploy agent on EC2. SSH to instance and run:
```
sudo yum update -y
sudo yum install -y ruby wget
wget https://aws-codedeploy-eu-west-1.s3.eu-west-1/amazonaws.com/latest/install
chmod +x ./install
sudo ./install auto
sudo service codedeploy-agent status
```
  1. Add 2 tags to instance (Name=webserver and Environment=development)
  1. In CodeDeploy, create a new Application with
    • Application name: CodeDeployDemo
    • Compute platform: EC2/On-premises (or Lambda or ECS)
  1. To create a deployment, you need to create a Deployment group (set of ec2 instances) first
  2. Create a Service Role in IAM/Roles/CodeDeploy/AWSCodeDeployRole
  3. Choose Deployment type: In-place (or Blue/green)
  4. Chooose EC2 instances with the tag | Environment=Development
  1. Now click “Create deployment“
  2. Choose the Deployment group created before
  3. Set the Revision type, My application is stored:
    • in S3
    • In GitHub

Create Bucket and enable versioning with CLI

Profile

aws configure --profile aws-devops


```
aws s3 mb s3://aws-devops-cicddemo --region us-east-1 --profile aws-devops
aws s3api put-bucket-versioning --bucket aws-devops-cicddemo --versioning-configuration Status=Enabled --region us-east-1 --profile aws-devops
```

Deploy the files ionto S3

```
aws deploy push --application-name CodeDeployDemo --s3-location s3://aws-devops-cicddemo/codedeploy-demo/app.zip --ignore-hidden-files --region us-east-1 --profile aws-devops
```

Check if code deploy success and complete

cd /var/www/html

Category: AWS Topics

Categories

  • AWS (4)
  • AWS Architecture (8)
  • AWS CLI (5)
  • AWS Cost (3)
  • AWS Health (4)
  • AWS Policies (2)
  • AWS Topics (24)
  • CHEAT SHEETS (16)
  • Container (21)
  • Datadog (4)
  • Jenkins (2)
  • Linux (9)
  • Microsoft (7)
  • Python (1)
  • SCRIPTS (9)
  • Terraform (5)
  • XMPie (6)
©2025 myCloud
Click to Copy