Search⌘ K
AI Features

Demo: Preparing an EC2 Instance for AWS CodeDeploy

Explore how to prepare EC2 instances for deployment using AWS CodeDeploy. Learn to create security groups, launch instances with key pairs, assign tags, and install the CodeDeploy agent. This lesson guides you through the essential setup tasks to enable smooth application deployments on AWS.

Let’s explore a high-level architecture of deploying applications using AWS CodeDeploy. AWS CodeDeploy requires creating a deployment group before starting a new deployment. A deployment group is a set of EC2 instances where our application will be deployed. AWS CodeDeploy does not automatically create the target instances; they must be manually provisioned. Another requirement for CodeDeploy is a service role that needs to be in place for the AWS CodeDeploy to access the target instances. The AWSCodeDeployRole is an AWS-managed role, and we don’t need to create the policy explicitly.

AWS CodeDeploy dependency architecture
AWS CodeDeploy dependency architecture

Create a security group

Before we create an EC2 instance, we need to create a security group to configure the port details for the incoming traffic. We can configure TCP, SSH, HTTP, and HTTPS traffic based on our project needs. We can use the create-security-group CLI command to create an empty security group.

Diff
root@educative:/# aws ec2 create-security-group --group-name edusg2 --description "Educative Security Group"
{
"GroupId": "sg-0f157bc37d927604a"
}
...