How do I flush DNS entries in my VPC in AWS?

Viewed 5215

I recently added VPC Endpoints to my CloudFormation stack. I then deleted my stack and tried to recreate it.

When I tried to recreate it, I got the following error:

private-dns-enabled cannot be set because there is already a conflicting DNS domain for secretsmanager.us-east-2.amazonaws.com in the VPC vpc-63170e0b (Service: AmazonEC2; Status Code: 400; Error Code: InvalidParameter; Request ID: b7d28d81-c2c0-4f44-9642-f22171cf513d)

I suspect the error is here because the VPC's private DNS still has an entry from the last time the stack was created.

Is there a way to manually remove entries from the private DNS of the VPC?

2 Answers

This is some kind of eventually consistency behavior when the private hosted zone record is deleted. It take some time and during it you will experience this error. Just wait some minutes and try again. It worked for me. Deploys performed after this first success are completed without problems.

Do no try to modify the VPC endpoint record manually because you will not find any "private hosted zone" in Route53. It is some kind of internal private hosted zone for AWS endpoints that is visible only from your VPC when you send a request to your VPC DNS endpoint.

I received a similar error when trying to rename and VPC endpoint in a CloudFormation stack.
There is no option to wait, so I fixed it by using the following steps:

  • Log into the AWS Console
  • Navigate to VPC -> Vitual Private Cloud -> Endpoints
  • In the list of Endpoints, find the entry causing the issue
  • CLick on the entry and select Actions -> Delete Endpoint
  • Wait for deletion (can take a few minutes)

I then reran my CloudFormation stack and all worked.

Related