This article provides a step-by-step guide on preparing an AWS EC2 instance for running a Java Spring Boot application with CodeDeploy. The process includes executing the following commands in PowerShell:
- Updating the EC2 instance with the latest packages using the command
sudo yum update
. - Installing the Amazon Corretto 17 JDK in headless mode for Java application support with
sudo yum install java-17-amazon-corretto-headless.x86_64 -y
. - Installing Ruby as a prerequisite for CodeDeploy using the command
sudo yum install ruby -y
. - Navigating to the
/home/ec2-user
directory withcd /home/ec2-user
. - Downloading the CodeDeploy agent installer script from the AWS S3 bucket using
wget
. - Granting executable permissions to the installer script with
chmod +x ./install
. - Running the CodeDeploy agent installer script in automatic mode with
sudo ./install auto
.
By following these instructions, you will set up your EC2 instance to be ready for deploying and managing Java Spring Boot applications using CodeDeploy.
Created .ppk key pair
Assign Proper IAM Role for Code Deploy
sudo yum update sudo yum install java-17-amazon-corretto-headless.x86_64 -y sudo yum install ruby -y cd /home/ec2-user wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install chmod +x ./install sudo ./install auto
You can verify the installation.
sudo service codedeploy-agent status java -version
It is recommended to let the AWS Systems manager Deploy the agent , In our scenario we are doing everything manually.