...

/

Demo: Preparing an EC2 Instance for AWS CodeDeploy

Demo: Preparing an EC2 Instance for AWS CodeDeploy

Learn how to create an EC2 instance and install the CodeDeploy agent.

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.

Press + to interact
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.

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

The next step is configuring the incoming traffic. We can use the authorize-security-group-ingress CLI command as shown below. This command uses the following arguments: ...