

AWS Mainframe Modernization Service (Managed Runtime Environment experience) is no longer open to new customers. For capabilities similar to AWS Mainframe Modernization Service (Managed Runtime Environment experience) explore AWS Mainframe Modernization Service (Self-Managed Experience). Existing customers can continue to use the service as normal. For more information, see [AWS Mainframe Modernization availability change](https://docs.aws.amazon.com/m2/latest/userguide/mainframe-modernization-availability-change.html).

# Set up AWS Transform for mainframe Runtime on Amazon EC2
<a name="ba-runtime-deploy-ec2"></a>

This topic explains how to set up and deploy the PlanetsDemo sample application using AWS Transform for mainframe Runtime on Amazon EC2.

**Topics**
+ [Prerequisites](#ba-runtime-deploy-prereq)
+ [Setting up](#ba-runtime-deploy-setup)
+ [Test the deployed application](#ba-runtime-deploy-test)

## Prerequisites
<a name="ba-runtime-deploy-prereq"></a>

Before you begin, make sure you complete the following prerequisites.
+ Configure the AWS CLI by following the steps in [Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html).
+ Complete [AWS Transform for mainframe Runtime prerequisites](ba-runtime-setup-prereq.md) and [Onboarding AWS Transform for mainframe Runtime](ba-runtime-setup-onboard.md).
+ Create an Amazon EC2 instance using one of the supported instance types. For more information, see [Get started with Amazon EC2 Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html).
+ Make sure you can connect to the Amazon EC2 instance successfully, for example by using SSM.
**Note**  
Throughout this guide, the Tomcat installation path is assumed to be `/m2-anywhere/tomcat-gapwalk/velocity`. Ensure you use this path when following the instructions below or adapt the following instruction to the path of your choice.
+ Download and extract AWS Transform for mainframe Runtime (on Amazon EC2) directly to the velocity directory `/m2-anywhere/tomcat-gapwalk/velocity` (the Tomcat installation folder). For instructions on how to retrieve the AWS Transform for mainframe Runtime artifacts, including information about storage, access, and content, see [AWS Transform for mainframe Runtime artifacts](ba-runtime-artifacts.md).
+ Download the [PlanetsDemo application archive](https://d3lkpej5ajcpac.cloudfront.net/demo/bluage/PlanetsDemo-v1.zip).
+ Unzip the archive and upload the application to an Amazon S3 bucket of your choice.
+ Create an Amazon Aurora PostgreSQL database for JICS. The AWS Transform for mainframe Runtime will automatically execute the `PlanetsDemo-v1/jics/sql/initJics.sql` script during the first startup. For information about how to create an Amazon Aurora PostgreSQL database, see [Creating and connecting to an Aurora PostgreSQL DB cluster](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_GettingStartedAurora.CreatingConnecting.AuroraPostgreSQL.html#CHAP_GettingStarted.AuroraPostgreSQL.CreateDBCluster).

## Setting up
<a name="ba-runtime-deploy-setup"></a>

To set up the PlanetsDemo sample application, complete the following steps.

1. Connect to your Amazon EC2 instance and go to the `conf` folder under your Apache Tomcat installation folder. Open the `catalina.properties` file for editing and replace the line that starts with `common.loader` with the following line.

   ```
   common.loader="${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar","${catalina.home}/shared","${catalina.home}/shared/*.jar","${catalina.home}/extra","${catalina.home}/extra/*.jar"
   ```

1. Navigate to the `/m2-anywhere/tomcat-gapwalk/velocity/webapps` folder.

1. Copy the PlanetsDemo binaries available at `PlanetsDemo-v1/webapps/` folder from the Amazon S3 bucket using the following command.

   ```
   aws s3 cp s3://path-to-demo-app-webapps/ . --recursive
   ```
**Note**  
Replace `path-to-demo-app-webapps` with the correct Amazon S3 URI for the bucket where you previously unzipped the PlanetsDemo archive.

1. Copy the content of `PlanetsDemo-v1/config/` folder to `/m2-anywhere/tomcat-gapwalk/velocity/config/`.

1. Provide the connection information for the database that you created as part of the prerequisites in the following snippet in the `/m2-anywhere/tomcat-gapwalk/velocity/config/application-main.yml` file. For more information see, [Creating and connecting to an Aurora PostgreSQL DB cluster](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_GettingStartedAurora.CreatingConnecting.AuroraPostgreSQL.html#CHAP_GettingStarted.AuroraPostgreSQL.CreateDBCluster).

   ```
   datasource:
      jicsDs:
        driver-class-name :  
        url: 
        username: 
        password: 
        type :
   ```

1. Start your Apache Tomcat server and verify the logs.

   ```
   /m2-anywhere/tomcat-gapwalk/velocity/startup.sh
   
   tail -f /m2-anywhere/tomcat-gapwalk/velocity/logs/catalina.log
   ```

   If you find error codes that start with a C followed by a number, such as CXXXX, note the error messages. For example, error code C5102 is a common error indicating an incorrect infrastructure configuration.

## Test the deployed application
<a name="ba-runtime-deploy-test"></a>

For an example of how to test the PlanetsDemo application, see [Test the PlanetsDemo application](ba-runtime-test-planetsdemo.md).