Review DNS settings for the SQS VPC endpoint

Enable the DNS settings needed for private SQS access.

Description

To resolve the standard SQS name to an interface endpoint’s private addresses, configure DNS on both the VPC and the endpoint.

Potential impact

With incorrect DNS settings, the application may fail to resolve SQS or use a public path.

Remediation

Enable enable_dns_support and enable_dns_hostnames on the VPC. Set private_dns_enabled = true on the endpoint. From the application environment, check that the SQS name resolves to the endpoint’s private addresses.

Examples

The excerpts show DNS settings for us-east-1. Specify endpoint subnets in the same VPC and allow HTTPS from the application in the endpoint’s security groups.

Before

hcl
resource "aws_vpc" "main" {
  cidr_block           = "172.16.0.0/16"
  enable_dns_support   = false
  enable_dns_hostnames = false
}

resource "aws_vpc_endpoint" "sqs_endpoint" {
  vpc_id            = aws_vpc.main.id
  service_name      = "com.amazonaws.us-east-1.sqs"
  vpc_endpoint_type = "Interface"
}

After

hcl
resource "aws_vpc" "main" {
  cidr_block           = "172.16.0.0/16"
  enable_dns_support   = true
  enable_dns_hostnames = true
}

resource "aws_vpc_endpoint" "sqs_endpoint" {
  vpc_id            = aws_vpc.main.id
  service_name      = "com.amazonaws.us-east-1.sqs"
  vpc_endpoint_type = "Interface"
  private_dns_enabled = true
}

References