Peering an AWS VPC with HashiCorp Cloud Platform (HCP)
The HashiCorp Cloud Platform (HCP) supports network peering with an AWS VPC. Network peering enables compute resources in two different networks to communicate with each other. In order for the Consul and Vault servers hosted on the HashiCorp Cloud Platform (HCP) to communicate with the clients hosted on your AWS environment, a network peering connection must be established.
This tutorial provides guidance on how to create a network peering connection between HashiCorp Cloud Platform and an AWS VPC.
Prerequisites
- Access to an AWS Account and user with permission to perform the following:
- Accept peering connections
- Create and edit security groups
- Create VPC routes
- Create IAM roles (automated method only)
- AWS CLI installed
- An HCP Account with an available HVN.
Create a peering connection
There are two methods to create a peering connection between the HCP HVN and AWS VPC - manual or automated.
The automated method connects to your AWS account and launches a CloudFormation template to complete the peering configuration. The CloudFormation template handles creating the peering request, accepting the peering request, and creating the necessary routes between the HVN and VPC.
The manual process will require you to perform each step in your HCP and AWS accounts.
Click HashiCorp Virtual Network in the left navigation menu.
Select the HVN you want to create a peering connection with.
In the selected HVN overview page, click Peering connections.
If you have peering connections available, they are listed in the center of the screen.
Click Create connection.
Select the Quick peering with quick-create links radio button.
Select the VPC region you want to create the peering connection in and click Launch stack creation in AWS CloudFormation.
A new browser tab/page will open. If you are not already authenticated, log into your AWS account.
In the Parameters section, select the VPC you wish to peer with your HCP HVN.
Click the I acknowledge that AWS CloudFormation might create IAM resources checkbox and click Create stack.
Monitor the progress until the status changes to CREATE_COMPLETE.
Return to the HCP Portal and click Peering connections in the left navigation menu. The new peering connection is listed.
Click Route table in the left navigation menu. In addition to creating, and accepting the peering connection, the automated process also handled route creation to allow traffic between your HCP HVN and AWS VPC.
Note
You can delete all resources created by the CloudFormation template by deleting the stack in AWS.
Next steps
In this tutorial, you created a peering connection between a HashiCorp Cloud Platform (HCP) and an AWS VPC.
HVN Peering connections can also be created using the HashiCorp Cloud Platform Terraform Provider. The HCP Terraform Provider can be found in the Terraform registry.
We encourage you to visit other HCP tutorials and continue to expand your learning.