

AWS 大型机现代化服务（托管运行时环境体验）不再向新客户开放。有关类似于 AWS 大型机现代化服务（托管运行时环境体验）的功能，请浏览 AWS 大型机现代化服务（自我管理体验）。现有客户可以继续正常使用该服务。有关更多信息，请参阅[AWS 大型机现代化可用性变更](https://docs.aws.amazon.com/m2/latest/userguide/mainframe-modernization-availability-change.html)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 在 Amazon EC2 上为大型机运行时设置 AWS 转换
<a name="ba-runtime-deploy-ec2"></a>

本主题介绍如何在 Amazon EC2 上使用大型机运行时 AWS 转换来设置和部署 PlanetsDemo 示例应用程序。

**Topics**
+ [先决条件](#ba-runtime-deploy-prereq)
+ [设置](#ba-runtime-deploy-setup)
+ [测试部署的应用程序](#ba-runtime-deploy-test)

## 先决条件
<a name="ba-runtime-deploy-prereq"></a>

在开始之前，请确保满足以下先决条件：
+  AWS CLI 按照配置 [AWS CLI 中的步骤进行配置](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)。
+ 完成 [AWS 针对大型机运行时先决条件进行转型](ba-runtime-setup-prereq.md)和[大型机运行时的入门 AWS 转换](ba-runtime-setup-onboard.md)。
+ 使用某个受支持的实例类型创建 Amazon EC2 实例。有关更多信息，请参阅 [Amazon EC2 Linux 实例入门](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html)。
+ 确保您可以成功连接到 Amazon EC2 实例，例如使用 SSM。
**注意**  
在本指南中，假设 Tomcat 的安装路径为。`/m2-anywhere/tomcat-gapwalk/velocity`在按照以下说明进行操作时，请确保使用此路径，或者根据您选择的路径调整以下指令。
+ 直接下载大型机运行时 AWS 变换（在 Amazon EC2 上）并将其提取到 velocity 目录`/m2-anywhere/tomcat-gapwalk/velocity`（Tomcat 安装文件夹）。有关如何检索适用于大型机的 Tr AWS ansform Runtime 工件（包括有关存储、访问和内容的信息）的说明，请参阅[AWS 针对大型机运行时工件进行转换](ba-runtime-artifacts.md)。
+ 下载[PlanetsDemo应用程序档案](https://d3lkpej5ajcpac.cloudfront.net/demo/bluage/PlanetsDemo-v1.zip)。
+ 解压缩存档文件，并将应用程序上传到您选择的 Amazon S3 存储桶。
+ 为 JICS 创建亚马逊 Aurora PostgreSQL 数据库。大型机运行时 AWS 转换将在首次启动时自动执行`PlanetsDemo-v1/jics/sql/initJics.sql`脚本。有关如何创建 Amazon Aurora PostgreSQL 数据库的信息，请参阅[创建并连接到 Aurora PostgreSQL 数据库集群](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/CHAP_GettingStartedAurora.CreatingConnecting.AuroraPostgreSQL.html#CHAP_GettingStarted.AuroraPostgreSQL.CreateDBCluster)。

## 设置
<a name="ba-runtime-deploy-setup"></a>

要设置 PlanetsDemo 示例应用程序，请完成以下步骤。

1. 连接到您的亚马逊 EC2 实例，然后转到 Apache Tomcat 安装`conf`文件夹下的文件夹。打开 `catalina.properties` 文件进行编辑，将以 `common.loader` 开头的行替换为以下行。

   ```
   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. 导航到 `/m2-anywhere/tomcat-gapwalk/velocity/webapps`文件夹。

1. 使用以下命令从 Amazon S3 存储桶中复制`PlanetsDemo-v1/webapps/`文件夹中可用的 PlanetsDemo 二进制文件。

   ```
   aws s3 cp s3://path-to-demo-app-webapps/ . --recursive
   ```
**注意**  
`path-to-demo-app-webapps`替换为之前解压缩存档的存储桶的正确 Amazon S3 URI。 PlanetsDemo 

1. 将 `PlanetsDemo-v1/config/` 文件夹的内容复制到 `/m2-anywhere/tomcat-gapwalk/velocity/config/`。

1. 在 `/m2-anywhere/tomcat-gapwalk/velocity/config/application-main.yml` 文件的以下代码段中，提供作为先决条件一部分而创建的数据库的连接信息。有关更多信息，请参阅[创建并连接到 Aurora PostgreSQL 数据库集群](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. 启动您的 Apache Tomcat 服务器并验证日志。

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

   如果您发现以 C 后跟数字开头的错误代码（例如 CXXXX），请记下错误消息。例如，错误代码 C5102 是一个常见错误，表示基础设施配置不正确。

## 测试部署的应用程序
<a name="ba-runtime-deploy-test"></a>

有关如何测试 PlanetsDemo 应用程序的示例，请参阅[测试 PlanetsDemo 应用程序](ba-runtime-test-planetsdemo.md)。