Skip to content

Instantly share code, notes, and snippets.

@phact
Created Aug 5, 2020
Embed
What would you like to do?
#!/bin/bash
PEERING_CONNECTION_ID=
REGION=
RECEIVER_VPC_ROUTE_TABLE_ID=
aws ec2 accept-vpc-peering-connection --vpc-peering-connection-id "$PEERING_CONNECTION_ID" --region "$REGION"
DEST_CIDR=$(aws ec2 describe-vpc-peering-connections --vpc-peering-connection-ids "$PEERING_CONNECTION_ID" --region "$REGION" | jq -r ".VpcPeeringConnections[].RequesterVpcInfo.CidrBlock")
aws ec2 create-route --route-table-id "$RECEIVER_VPC_ROUTE_TABLE_ID" --destination-cidr-block "$DEST_CIDR" --vpc-peering-connection-id "$PEERING_CONNECTION_ID" --region "$REGION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment