Creating a Linux AMI for the Sample Application
This section describes the typical steps required to create a Linux AMI for the Sample Application. This AMI is then used to deploy the Sample Application on the EC2 Auto Scaling Group.
Important: The Sample Application is used for demonstrating how the Application Protector Java can be set up with an application, which in this case is a Spring Boot application. You can choose to create a custom AMI by integrating your custom application with the Application Protector Java libraries.
Important: Red Hat Linux and Amazon Linux instances are supported, because the user data scripts in the CloudFormation template use yum as the package manager. If you want to use a different distribution of Linux, then ensure that you modify the UserData section in the CloudFormation template to use another package manager that is compatible with the specific distribution.
To create a Linux AMI:
Create an EC2 Linux instance and ensure that you have installed the latest version of Java on the Linux instance.
Ensure that yum is the default package manager for the EC2 instance.
For more information about how to create an EC2 Linux instance on AWS, refer to the section Getting Started with Amazon EC2 Linux Instances.
Connect to your EC2 Linux instance using SSH.
For more information about how to connect to an EC2 Linux instance using SSH, refer to the section Connecting to Your Linux Instance Using SSH.
Switch to the root user using the following command.
sudo suRun the following command to create the directory structure.
mkdir -p /opt/protegrity/appRun the following command to add a new user.
useradd -ms /bin/bash ptyitusrNavigate to the protegrity directory by running the following command.
cd /opt/protegrityCopy the apjava-springboot-0.1.0.jar file from step 4 of the section Creating a JAR File for the Sample Application to the /opt/protegrity directory.
Copy the ApplicationProtector_Linux-ALL-64_x86-64_JRE-_<Build_version>.tgz file from step 2 of the section Extracting the Linux Installation Package to the /opt/protegrity directory.
Run the following command to setup and install the Sample Application.
# Install the Sample Application cp apjava-springboot-0.1.0.jar app.jar jar -xf app.jar && \ mv BOOT-INF/lib app/lib && \ mv META-INF app/META-INF && \ mv BOOT-INF/classes/* app && \ rm -rf app/lib/ApplicationProtectorJava.jar app/lib/jna*4.1.0.jar app/ApplicationProtectorJava.properties BOOT-INF app.jar orgRun the following command to change the owner of the the /opt/protegrity directory to the ptyitusr user.
chown -R ptyitusr:ptyitusr /opt/protegrityPerform the following steps to create an AMI from the running EC2 instance.
Navigate to the Instances screen in the AWS Management Console.
Right-click your running EC2 instance, and then click Image > Create Image.
The Create Image screen appears.
Enter the required details in the Create Image screen.
Click Create Image.
For more information about creating an AMI from a running EC2 instance, refer to the section Create an AMI from an Amazon EC2 Instance.
Feedback
Was this page helpful?