6. Configure CodeDeploy

Install CodeDeploy in the EC2

Connect to the EC2 terminal that just have launched.

Install ruby that CodeDeploy agent will depend on then CodeDeploy agent.

sudo -i

dnf install -y ruby

cd /home/ec2-user
aws s3 cp s3://aws-codedeploy-us-west-1/latest/install .
chmod +x ./install
./install auto
systemctl status codedeploy-agent

CodeDeploy service will need this agent running in the EC2.

Create CodeDeploy application

CodeDeploy - Applications - Create application

Use the application name in the workflow file env.

Compute platform is EC2/On-premises.

Create another IAM role for CodeDeploy

This is third IAM role I have made.

IAM - Roles - Create role

Select trusted entity: AWS Service

Use case: CodeDeploy

Permissions: AWSCodeDeployRole

Role name: OurCompanyLunchCodeDeployRole

Permissions is already selected to it.

Create CodeDeploy deployment group

Name a deployment group after the workflow file env.

IAM service role that I just made will be used here.

Select EC2 instances option.

Input "Name" tag and the value that the EC2 name I decided earlier.

It will show 1 matched instance.

This is why I added SSM permission in EC2 IAM role. It says first install can be done by SSM. But I did it myself.

I disabled load balancer because I didn't make one. It's enabled by default.

Finally, click create.

Last updated