Add a BYOC VPC Peering Connection on AWS

To start sending data to the Redpanda cluster, you must configure the VPC network connection by connecting your Redpanda VPC to your existing AWS VPC.

Prerequisites

Create a peering connection

  1. In the AWS management console or the CLI, create a new peering connection between your AWS VPC and your Redpanda network using the following:

    • VPC Requester: Your Redpanda VPC. This looks something like network-ch2c2ntioepec6ilaoog.

    • VPC Accepter: Your existing AWS VPC ID.

  2. After the VPC peering connection is created, make note of your peering connection ID. It has a pcx- prefix.

Create routes from Redpanda to AWS

The following command routes traffic from Redpanda to AWS by finding the route tables for each associated subnet and creating a route:

aws ec2 describe-route-tables --filter "Name=tag:Name,Values=network-<redpanda-cluster-id>" "Name=tag:purpose,Values=private" | jq -r '.RouteTables[].RouteTableId' | \
while read -r route_table_id; do \
aws ec2 create-route --route-table-id $route_table_id --destination-cidr-block <aws-vpc-cidr-block> --vpc-peering-connection-id <peering-connection-id>; \
done;

Replace the following placeholder values:

  • Redpanda cluster ID: This is listed in the Overview page of your cluster.

  • AWS CIDR block: This is listed in the AWS UI Details for your VPC.

  • Peering connection ID: This is the ID of the peering connection noted in step one.

Create routes from AWS to Redpanda

Now you must route your AWS subnet(s) to your Redpanda CIDR. The base command:

aws ec2 --region <region> create-route \
  --route-table-id <aws-route-table-id> \
  --destination-cidr-block <redpanda-cidr-range> \
  --vpc-peering-connection-id <peering-connection-id>

Your VPC may have multiple subnets, which may have multiple route table associations. Add the route to all the subnets.

Test your connection

There are two ways to test your connection:

  • Return to your cluster overview, and follow the directions in the How to connect panel.

  • Use the AWS Reachability Analyzer. Select your VM instance and a Redpanda instance as the source and destination, and test the connection between them.