Deploying Ops Manager on AWS Using Terraform
Page last updated:
This guide describes the preparation steps required to deploy Pivotal Operations Manager on Amazon Web Services (AWS) using Terraform templates.
The Terraform template for Ops Manager on AWS describes a set of AWS resources and properties. For more information about how Terraform creates resources in AWS, see AWS Provider in the Terraform documentation.
If you are deploying Pivotal Application Service (PAS), review different deployment options in Reference Architecture for Pivotal Platform on AWS.
Before you deploy Ops Manager on AWS:
If you intend to install PAS, see Pivotal Platform on AWS Requirements.
If you intend to install Pivotal Container Service (PKS), see AWS Prerequisites and Resource Requirements.
In addition to reviewing the prerequisites for your runtime, ensure you have:
The Terraform CLI
In your AWS account, ensure you have an IAM user with the following permissions:
- IAM policies:
- Key policies:
- kms:UpdateKeyDescription action allowed
- IAM policies:
Before you can run Terraform commands to provision infrastructure resources, you must download the AWS Terraform templates and create a Terraform template variables file. To download the templates and create a template variables file:
On Pivotal Network, navigate to the Pivotal Application Service (formerly Elastic Runtime) release.
Download the AWS Terraform templates ZIP file.
Extract the contents of the ZIP file.
Move the extracted folder to the
workspacedirectory on your local machine.
On the command line, navigate to the extracted folder. For example:
Navigate to the
terraforming-pksdirectory that contains the Terraform files for your runtime.
In the runtime directory, create a text file named
terraform.tfvarsfile and add:
env_name = "YOUR-ENVIRONMENT-NAME" access_key = "YOUR-ACCESS-KEY" secret_key = "YOUR-SECRET-KEY" region = "YOUR-AWS-REGION" availability_zones = ["YOUR-AZ-1", "YOUR-AZ-2", "YOUR-AZ-3"] ops_manager_ami = "YOUR-OPS-MAN-IMAGE-AMI" dns_suffix = "YOUR-DNS-SUFFIX" ssl_cert = <<SSL_CERT -----BEGIN CERTIFICATE----- YOUR-CERTIFICATE -----END CERTIFICATE----- SSL_CERT ssl_private_key = <<SSL_KEY -----BEGIN EXAMPLE RSA PRIVATE KEY----- YOUR-PRIVATE-KEY -----END EXAMPLE RSA PRIVATE KEY----- SSL_KEY
Edit the values in the file according to the table below:
Value to replace Guidance
Enter a name to use to identify resources in AWS. Terraform prepends the names of the resources it creates with this environment name.
Note: You can only enter lowercase alphanumeric characters and hyphens. Examples include
Enter your AWS Access Key ID of the AWS account in which you want Terraform to create resources.
Enter your AWS Secret Access Key of the AWS account in which you want Terraform to create resources.
Enter the name of the AWS region in which you want Terraform to create resources. For example,
Enter three availability zones from your region. For example,
Enter the source code for the Ops Manager Amazon Machine Image (AMI) you want to boot. You can find this code in the PDF included with the Ops Manager release on Pivotal Network.
If you want to encrypt your Ops Manager VM, create an encrypted AMI copy from the AWS EC2 dashboard and enter the source code for the copied Ops Manager image instead. For more information about copying an AMI, see the Launch an Ops Manager AMI section of the Deploying Ops Manager on AWS Manually topic.
To prevent the creation of an Ops Manager VM, set this value to an empty string (
""). When using Platform Automation, you must disable the creation of the Ops Manager VM from Terraform. For more information, see Platform Automation.
Enter a domain name to use as part of the system domain for your deployment. Terraform creates DNS records in AWS using
YOUR-DNS-SUFFIX. For example, if you enter
example.comfor your DNS suffix and have
pcfas your environment name, Terraform creates DNS records at
Enter a certificate to use for HTTP load balancing. For production environments, use a certificate from a Certificate Authority (CA). For test environments, you can use a self-signed certificate.
Your certificate must specify your system domain as the common name. Your system domain is
It also must include the following subdomains:
Enter a private key for the certificate you entered.
Complete this step if you want to:
Use an AWS Relational Database Service (RDS) for your PAS deployment. For more information, see Getting started with Amazon RDS in the AWS documentation.
Deploy the Isolation Segment tile.
terraform.tfvars file, specify the appropriate variables from the sections below.
Note: You can see the configurable options by opening the
variables.tf file and looking for variables with default values.
If you plan to deploy the Isolation Segment tile, add the variables below to your
terraform.tfvars file, replacing
YOUR-PRIVATE-KEY with a certificate and private key.
create_isoseg_resources = 1 iso_seg_ssl_cert = <<ISO_SEG_SSL_CERT -----BEGIN CERTIFICATE----- YOUR-CERTIFICATE -----END CERTIFICATE----- ISO_SEG_SSL_CERT iso_seg_ssl_cert_private_key = <<ISO_SEG_SSL_KEY -----BEGIN EXAMPLE RSA PRIVATE KEY----- YOUR-PRIVATE-KEY -----END EXAMPLE RSA PRIVATE KEY----- ISO_SEG_SSL_KEY
YOUR-CERTIFICATEis your certificate.
YOUR-PRIVATE-KEYis your private key.
This causes Terraform to create an additional HTTP load balancer across three availability zones to use for the Isolation Segment tile.
To use an AWS RDS for your deployment:
Add the following to your
rds_instance_count = 1
To specify a username for RDS authentication, add the following variable to your
rds_db_username = "YOUR-DATABASE-NAME"
YOUR-DATABASE-NAMEis the name of your RDS.
To use the Terraform CLI to create resources on AWS:
From the directory that contains the Terraform files, initialize the directory based on the information you specified in the
terraform.tfvarsfile by running:
Note: If you see the error
heredoc not terminated, then open the
terraform.tfvarsfile and delete any trailing spaces that follow heredoc terminators such as EOF. Then, run the
terraform initcommand again.
To create the execution plan for Terraform, run:
terraform plan -out=plan
To execute the plan from the previous step, run:
terraform apply plan
It may take several minutes for Terraform to create all the resources in AWS.
To create a DNS record for your deployment:
In a browser, navigate to the DNS provider for the DNS suffix you entered in your
Create a new NS record for your system domain. Your system domain is
In this record, enter the name servers included in
env_dns_zone_name_serversfrom your Terraform output.
Note: Terraform creates a
for the domain prefixed with the environment name.
If your base domain is registered with AWS,
ensure that the NS record from the terraform-created recordset is copied in the domain recordset before proceeding.
Proceed to the next step in the deployment, Configuring BOSH Director on AWS Using Terraform.