How do I set the AWS peering connection DNS resolution options through CloudFormation?

Viewed 1459

I have two VPCs:

  • VPC1 which holds our RDS instance.
  • VPC2 which holds our cluster of EC2 instances.

We have successfully setup a VPC peering connection, routes and security groups to allow appropriate communication.

In order to resolve the RDS instance AZ-appropriate local IP address from it's hostname, we need to follow these instructions and set --requester-peering-connection-options AllowDnsResolutionFromRemoteVpc=true.

If I do this manually through the AWS Console or the AWS CLI it all works fine, however I'm creating the cluster of EC2 instances through CloudFormation and the option is missing from the CloudFormation documentation.

The effect of this is that my stack starts up and fails because the services themselves cannot connect to the database.

Am I doing something obvious wrong, or is this just Amazon being incomplete?

Thanks!

1 Answers

Due to the frequency of updates, there are many times where an AWS feature isn't available in CloudFormation (ALB targeting Lambda used to be) - you end up having to create a custom resource to manage it. It's not too bad, just make sure that your lambda responds with success or failure in all scenarios, including exceptions, otherwise your stack will be 'in progress' for hours.

Related