Deployment With AWS Codedeploy
Env Setup
- Create a new EC2 service role, which have access to S3 bucket
- Launch a new EC2 instance with the role from previous step attached
- Install CodeDeploy agnet on the EC2 instance
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 status
- Create a CodeDeploy service role and attach AWSCodeDeployRole policy
Code Deploy
- Create the application and upload code
aws deploy create-application --application-name mywebapp
aws deploy push --application-name mywebapp --s3-location s3://{bucket_name}/webapp.zip --ignore-hidden-files
-
Create a deployment group with name of my-dep-group under application mywebapp, and choose the service role created earlier
-
Create a deployment