AWS Cloud Operations Blog
AWS Mainframe Modernization now available in Terraform
Leveraging Infrastructure as Code for AWS Mainframe Modernization with Terraform
AWS Mainframe Modernization service is a cloud-native platform to modernize, migrate, execute, and operate mainframe applications. In addition to analysis and transformation tools, it provides a fully-managed and resilient runtime environment making it easierto run and operate modernized applications.
Starting today, you can define AWS Mainframe Modernization service resources using HashiCorp Terraform. We recommend that you have a working understanding of both Terraform and AWS Mainframe Modernization before going through this blog post. For more information on Terraform, visit the Introduction to Terraform on AWS Workshop to learn more.
Solution Overview
In this solution, we have taken the Planet Demo application and using the AWS Blu Age Runtime within the Managed Mainframe Runtime Environment engine we will demonstrate how we can create this environment using Terraform. Customers also have the option to select the Micro Focus engine should they intend to deploy this sample application with the Micro Focus run time
Walkthrough
In this section, we will walk through deploying an example application to a Mainframe Modernization Environment in a dedicated VPC.
Prerequisites
To complete the steps described in this post, you will need the following:
- To download and setup Terraform, see the article, Install Terraform. See the article, Get Started – AWS, for instructions to get started with Terraform on AWS.
- Validate the AWS Provider version is > v5.43.0.
- Make sure that your AWS role has the correct permissions to deploy Mainframe Modernization resources.
Deployment Steps
- Validate that your AWS CLI profile is configured in your terminal and your Terraform environment.
- Clone the aws-m2-example-with-terraform repository.
$ git clone https://github.com/aws-samples/aws-m2-example-with-terraform
- Change into the downloaded directory.
$ cd aws-m2-example-with-terraform
- Download the PlanetsDemo application.
$ curl https://d3lkpej5ajcpac.cloudfront.net/demo/bluage/PlanetsDemo-v1.zip -o PlanetsDemo-v1.zip</p><p> </p>
- Edit terraform.tfvars and change my_public_ip to your ip.
my_public_ip = "1.2.3.4"
- Initialize the Terraform.
$ terraform init
- Apply the configuration to create the infrastructure.
$ terraform apply
Apply complete! Resources: 20 added, 0 changed, 0 destroyed. Outputs: application_url = "http://ux4453jdhrghfbpzqctvy7ooqi-abdcefeedfsdgdgd.elb.us-east-2.amazonaws.com:8196/PlanetsDemo-web-1.0.0/"
Congratulations! You have deployed your first Mainframe Modernization application.
Testing Planet Demo
Open the application_url output in your browser:
Enter PINQ in the input box(Figure 1 ) and click Run.
Figure 2 – output from JICS transaction
You should get the data from the transaction server (shown in figure 2 with MARS as example). Once done, you may close the browser tab.
Cleaning up
Leaving resources that you no longer need in your AWS account may incur charges. If you would like to remove the resources that were created with this solution, please follow the instructions to delete the infrastructure.
Destroy the infrastructure.
$ terraform destroy
Enter a value: yes
resources are removed, you will see a Terraform output similar to the following message:
Destroy complete! Resources: 20 destroyed.
Conclusion
In conclusion, this blog post provides a comprehensive guide to leveraging Terraform for deploying AWS Mainframe Modernization. We discussed the importance of a well-structured project, initial code setup, integration between Mainframe Modernization and Terraform, parameter substitution, and remote state management. By following these best practices, developers can create and manage their MicroFocus or BluAge environments more effectively while maintaining clean, modular, and reusable code. Embracing infrastructure as code such as Terraform, will enable you to build scalable and maintainable applications.