Skip to content

Instantly share code, notes, and snippets.

@dfrankel33
Created January 29, 2018 20:40
Show Gist options
  • Save dfrankel33/fd1642297db97573fa0a884ddbc73d32 to your computer and use it in GitHub Desktop.
Save dfrankel33/fd1642297db97573fa0a884ddbc73d32 to your computer and use it in GitHub Desktop.
RCL definition to create a VPC Route where a NAT Gateway is the next hop
define create_nat_route($route_table_id, $nat_gateway_id, $region) return $response do
$response = http_request(
host: "ec2."+$region+".amazonaws.com/?Action=CreateRoute&DestinationCidrBlock=0.0.0.0/0&RouteTableId="+$route_table_id+"&NatGatewayId="+$nat_gateway_id+"&Version=2016-11-15",
https: true,
verb: "post",
signature: {"type": "aws"}
)
end
# Example:
# provision(@route_table) #rs_cm.route_table
# provision(@nat_gateway) #rs_aws_vpc.nat_gateway
# call create_nat_route(@route_table.resource_uid, @nat_gateway.natGatewayId, "us-west-1") retrieve $nat_route_response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment