Created
August 5, 2020 17:47
-
-
Save phact/5b3268c762291945caf25e0d89fcd154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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