Networking & Content Delivery

Managing DNS resolution with Amazon VPC Lattice and VPC resources

In our previous post External Connectivity to Amazon VPC Lattice, we discussed how your applications could consume VPC Lattice services from clients external to Amazon Web Services (AWS), as well as cross-Region patterns. At re:Invent 2024, AWS made three significant announcements in the application networking space: releasing the VPC resources capability for AWS PrivateLink, support for accessing these resources through Amazon VPC Lattice, and the capability to create endpoints for VPC Lattice service networks.

These releases create opportunities for extra functionality and streamlining of your multi-modal service-to-service communications. Although the new connectivity patterns are explained in detail in the Amazon VPC Lattice: modernize and simplify your enterprise network architectures post, we wanted to spend some time discussing the following points in more detail:

  1. What impact does the implementation of these new components have on service endpoint discovery?
  2. How should I configure DNS resolution to consume my services/resources?

In this post, we focus on how to obtain the AWS-generated domain name configuration for VPC Lattice services and VPC resources, and how to configure DNS resolution properly for your consumers.

Ready?

Brief reminder: how does a VPC Lattice service network VPC association work?

We start with a refresher for VPC Lattice, using the architecture in Figure 1. This shows a consumer VPC, directly associated with a service network (standard architecture prior to re:Invent 2024).

When you create a VPC Lattice service you are provided with an AWS-generated DNS name that represents it. This name is globally unique and externally resolvable to a series of IP addresses in the 169.254.171.x/24 range and the fd00:ec2:80::/64 range. IPv4 Link-local and IPv6 unique local addresses are not globally routable and are intended for devices that are either connected to the same physical (or logical) link or within a more limited area/site. Within AWS, when an application in a consumer VPC resolves a VPC Lattice service to these addresses, packets put on the wire to that address and are routed to a hidden ingress endpoint for VPC Lattice.

High-level VPC Lattice architecture. At the left-hands side, a consumer VPC with an Amazon EC2 instance as example application. This VPC is associated with a VPC Lattice service network using a VPC association. At the right-hand side, an AWS Lambda function as provider, published using a VPC Lattice service. This service is associated to the same VPC Lattice service network.

Figure 1. VPC Lattice service network VPC association.

Many users want to use custom domain names to refer to these services. To configure this, you need to create a vanity/masquerade record that represents the domain name generated by VPC. You must retrieve this information from the VPC Lattice service configuration: Domain Name and the Hosted Zone values.

Figure 2 shows this from within the AWS console and Figure 3 shows the output when using the AWS Command Line Interface (AWS CLI).

AWS Management console view of a VPC Lattice service detail section. In red circles, some items are highlited: Hosted Zone ID, Domain Name, and Custom Domain Name.

Figure 2. VPC Lattice service information (console).

aws vpc-lattice get-service --service-identifier svc-XXXX --region YYY

Screenshot of an AWS CLI command obtaining a VPC Lattice service information. In red circle, some information is highlited: Custom Domain Name, Domain Name, and Hosted Zone ID.

Figure 3. VPC Lattice service information (CLI).

These allow you to create an Alias record in a DNS Zone that you have control over, perhaps a Private Hosted Zone (PHZ) in AWS. The Hosted Zone values are needed if you create an Alias record at the DNS Zone apex.

Accessing VPC resources through Associations and Endpoints

The recap is complete, now we can dive into what’s new here.

VPC Resources offers a new data-plane within AWS, where endpoints such as AWS Databases, Amazon Elastic Compute Cloud (Amazon EC2) instances, Domain Name targets, and IP addresses can be reached. Both PrivateLink and VPC Lattice now support direct TCP connections to endpoints. This eliminates the requirement for AWS Network Load Balancers (NLBs) with PrivateLink. For brevity we won’t cover the details on how VPC resources work here, instead we recommend that you check out the details in Jeff Barr’s News post to get an overview of the new features.

However, we can summarize some important concepts before discussing the DNS resolution:

  1. Resource definition: VPC resources are defined by creating a Resource Configuration that can be either:
    1. Single (single resource with a target type DNS or IP)
    2. Group (collection of child resource configurations)
    3. Child (object within a group, sharing the same configuration)
    4. ARN (to access supported AWS resources).
  2. Resource Association: VPC resources can be exposed using three methods:
    1. Association with an Interface endpoint of the type “resource
    2. Association with an Interface endpoint of the type “service network
    3. Association with a VPC Lattice service network

DNS resolution for access methods

With the release of VPC resources and new endpoint types, there are now multiple ways to connect to both VPC Lattice services and VPC resources. Table 1 details these options:

Connectivity mapping table

Table 1. Connectivity mapping.

During this section we explore how DNS resolution works for these different entities and access methods. Note that the connection to VPC Lattice services from a VPC Lattice service network association (first column, first row in the preceding table) was already covered at the beginning of this post.

Accessing VPC resources through a VPC Lattice service network VPC association

In this configuration, a consumer VPC is associated with a service network that also has VPC resources associated to it. How does this VPC resource publication differ from VPC Lattice services?

As mentioned previously, a globally unique and externally resolvable domain name is created per resource association to the service network as well as a Hosted Zone ID. Depending on the Resource Configuration type, you find some differences:

  • Child resources (regardless of being in a Group or not) have their own resolution configuration
  • ARN resources create a managed Child resource configuration, which is the one targeting the resource itself

One key difference between VPC Lattice services and VPC resources DNS resolution is in the IP address space used. The IPv4 addresses used for resource connectivity come from the public 129.224.0.x/17 range. For IPv6, addresses come from the fd00:ec2:80::/64 range – used for both VPC Lattice services and VPC resources.

High-level VPC Lattice architecture when consuming VPC resources. At the left-hands side, a consumer VPC with an Amazon EC2 instance as example application. This VPC is associated with a VPC Lattice service network using a VPC association. At the right-hand side, an Amazon RDS instance as provider, published using a VPC resource configuration. This resource configuration is associated to the same VPC Lattice service network.

Figure 4: VPC Lattice service network VPC association (VPC resource association).

To set up any sort of alias for the generated domain name, as done previously, we need to retrieve the association’s domain name and Hosted Zone ID. For an example we use an ARN-type Resource Configuration. First, as you see in Figure 5, two Resource Configurations are created:

  • The entry of the type ARN is the “parent”, which is the same as if you create a Resource Configuration of the type Group.
  • The Child entry is the resource providing the DNS information we need for the resolution.

From the console, choose the Child resource name to obtain the information shown in Figure 6.

AWS Management Console view showing a list of Resource Configurations created.

Figure 5. Resource Configuration ARN type (console view).

AWS Management Console view showing a resource configuration association details. In red circles some information is highlighted: Domain Name, and Hosted Zone ID

Figure 6. VPC resource association – Child – information (console).

If you prefer to use AWS CLI, then using the resource association ID (snra-x…) allows you to obtain the DNS information needed to setup the alias by using the following command:

aws vpc-lattice get-service-network-resource-association --service-network-resource-association snra-XXX --region YYY

Screenshot of an AWS CLI output obtaining information about a resource configuration association. In a red circle, the following information is highlighted: Domain Name, and Hosted Zone ID

Figure 7. VPC resource association information – Option 1 (CLI).

For ARN types, you may not have the resource association ID (because the Child is generated and not created by you). You can obtain the desired information by performing some extra actions using the ID of the Parent Resource Configuration. Specifically, you need to issue a query to list all of the resource associations of a service network, with the following filters:

  • The value ‘resourceConfigurationName’ starts with the Resource Configuration ID of the parent resource.
  • The value ‘isManagedAssociation’ is equal to true.

aws vpc-lattice list-service-network-resource-associations --service-network-identifier sn-XXX --region YYY --query 'items[?isManagedAssociation==`true`]|[?starts_with(resourceConfigurationName,`rcfg-ZZZZZ`)==`true`]' 

Screenshot of an AWS CLI output obtaining information about a resource configuration association (filtering by a list of associations). In a red circle, the following information is highlighted: Domain Name, and Hosted Zone ID

Figure 8. VPC resource association information – Option 2 (CLI).

The DNS configuration in consumer VPCs remains consistent: simply create an ALIAS record in a DNS zone that you control, referencing the global unique record (Domain Name an Hosted Zone ID).

Accessing VPC Lattice services and VPC resources through VPC Lattice service network endpoints

As mentioned previously, VPC Lattice services and VPC resources can now be reached by using VPC Lattice service network endpoints. Service network endpoints now work beyond their associated VPCs, enabling connections from on-premises locations and cross-Region applications. These endpoints support IPv4, IPv6, and dual-stack addressing. For IPv6 addresses the denyAllIgwTraffic flag is enabled, which means that the endpoint can only be used for private communication.

A typical hybrid model using this feature is shown in Figure 9.

High-level VPC Lattice architecture when consuming services or resources from VPC Lattice in hybrid or cross-Region architectures.

Figure 9. VPC Lattice service network endpoint (hybrid and cross-Region).

If you are familiar with interface VPC endpoints, then we should discuss some differences:

  • With Interface Endpoints of the type ‘service network’, you don’t need to create an endpoint per service/resource to connect to. All of the services/resources associated can be reached from a single endpoint.
  • Each endpoint can consume multiple /28 IPv4 and /80 IPv6 range per subnet/AZ. From this range, several VPC Lattice services may consume and share a single secondary IP address, while each VPC resource consumes independent secondary IP addresses.

This means that the Primary interface IP address of the interface cannot be used for routing traffic for services or resources. They must be resolved to their respective secondary IP addresses.

A new globally unique and externally resolvable domain name is created for each service/resource associated to the service network associated to the endpoint. These domain names provide the IP addresses each service/resource is consuming from the secondary range. They are viewable in the console, when looking at the Associations tab of the endpoint.

AWS Management Console view showing the associations of a service network endpoint. In a red circle it is highlighted the DNS information of those associations.

Figure 10. VPC Lattice service network endpoint associations (console).

aws ec2 describe-vpc-endpoint-associations --vpc-endpoint-ids vpce-XXX --region YYY 

Screenshot of an AWS CLI output showing the service network endpoint associations. In red circles its is highlighted the DNS information of those associations.

Figure 11. VPC Lattice service network endpoint associations (CLI).

With this information, you can update the DNS resolution configuration dependent on your use case and consumer application location:

  • For applications located in another AWS Region (multi-Region connectivity), you can configure a Private Hosted Zone (with Alias records configured) associated to those VPC(s).
  • For applications located in on-premises environments (hybrid connectivity), we recommend following the Hybrid DNS with Route 53 Resolver Endpoints reference architectures.

Accessing VPC resources through PrivateLink interface endpoints

If you are not using VPC Lattice, then VPC resources can be accessed using a more traditional PrivateLink interface. As detailed previously, there is new interface type for this: the Interface endpoint of the type “resource”.

High-level architecture of the VPC resource consumption using VPC endpoints. At the left-hands side, a consumer VPC with an Amazon EC2 instance as example application and an endpoint. At the right-hand side, another EC2 instance as provider, published using a VPC resource configuration. This resource configuration is associated to the VPC endpoint in the consumer VPC

Figure 12. VPC Resources through PrivateLink resource endpoint.

In the following configuration, a VPC Resource of the type Single has been created and associated with a Resource Gateway. A Resource endpoint has also been deployed and associated with the Resource Configuration.

AWS Management Console view of the details of a resource configuration and its association to a VPC endpoint.

Figure 13. VPC Resources through PrivateLink resource endpoint (console).

Take a moment to review the IP addressing for this endpoint, shown in Figure 14. There are only two IP address (one per Availability Zone (AZ)). This is familiar in concept to how PrivateLink endpoints work more generally.

AWS Management Console view of the information of a VPC endpoint. In a red circle, the assigned IPs of the endpoint.

Figure 14. VPC Endpoint (resource) addressing.

The auto-generated DNS name of the VPC resource can be retrieved at the endpoint association level. From the console, we need to look at the Endpoint, specifically, the Associations tab as shown in Figure 15. If you use the CLI, then you can check Figure 16 to see how to obtain the information.

AWS Management Console view of a VPC endpoint association (VPC resource). In a red circle, it is highlighted the DNS information of such association.

Figure 15. VPC Resource Naming (console).

aws ec2 describe-vpc-endpoint-associations --vpc-endpoint-ids vpce-XXX --region YYY 

Screenshot of an AWS CLI output of a VPC endpoint association. In a red circle it is highlighted the DNS information of such association.

Figure 16. VPC Resource Naming (CLI).

To add a vanity/masquerade name, you can create an alias record in a suitable Private Hosted Zone, aliased to the autogenerated DNS name, specifying the Hosted Zone ID.

Service connectivity from external applications

So far we have covered the five connectivity patterns documented within Table 1. However, you may be missing one: how to consume services/resources from consumers outside of AWS without a private communication. As new services/resources are added to your environment, IP addresses that are used to connect to them can change. For this reason, our view is that it remains clearer to harness an ingress proxy layer that can perform dynamic lookups and resolution for your services and resources on your behalf. Without this dynamic layer front-ending your traffic, further steps would be needed to discover endpoint secondary IP address information and dynamically update any static configurations that you have deployed.

The solution you choose can be a wholly owned one (as discussed in our previous post) or might involve a partner offering. Ingress proxying for VPC Lattice services is also possible using Amazon API Gateway, as discussed in this Amazon Containers post.

Check the Guidance for External Connectivity to Amazon VPC Lattice for a fully automated solution using an NLB targeting a fleet of lightweight serverless proxies on AWS Fargate.

High-level architecture showing the consumption of services and resources published using VPC Lattice via public endpoints.

Figure 17. VPC Lattice services and VPC resources consumed by external applications.

With the release of VPC Lattice service network endpoints, this solution can be further optimized. Previously there was a 1:1 mapping consideration between the ingress solution VPC and the service network with which it was associated. Opting to use an endpoint instead of a VPC association allows this ingress proxy solution to be used to reach any service network within the Region!

PrivateLink resource endpoints allow you to remove the need of the proxy solution and target endpoints directly from an ELB. At scale, we still recommend the use of a VPC Lattice service network to have a single place to control the connectivity and security of your services/resources and reduce endpoint sprawl.

We know, you need a summary

The following table summarizes the recommended access modalities for the different entity types that are exposed.

Summary of access modality via VPC Lattice or VPC endpoints.

Table 2. Summary of access modality via VPC Lattice or VPC endpoints.

Further considerations

  • Consider the use of VPC Lattice service network associations as the principal access method for both VPC Lattice service and VPC resource access. This streamlines the connectivity requirements and creates a strong mapping between a VPC and its intended use.
  • Consider using VPC Lattice service network endpoints for multi-dimensional use cases such as split function VPCs, hybrid and external access through proxy layers.
  • Consider the use of PrivateLink resource endpoints when you are predominantly an PrivateLink user with no immediate plans for scaling access to services.
  • In multi-Account environments, you can share the following resources through AWS Resource Access Manager (AWS RAM): VPC Lattice service networks, VPC Lattice services, and VPC Resource Configurations.
  • When working at scale, we recommend the following related to the DNS resolution configuration:
  • You can apply granular security with VPC Lattice services using sigV4 signing. For applications that reside outside of AWS, consider using IAM Roles Anywhere to get the necessary credentials.

Conclusion

In this post we have reviewed different connectivity patterns to consume VPC Lattice services and VPC resources, focusing on how to obtain and configure the necessary DNS resolution from VPCs in the same AWS Region, cross-Region, and on-premises environments. We provided some guidance on how to think about the new AWS capabilities and where and how to deploy and access them.

Visit the Amazon VPC Lattice product pagedocumentation, and pricing page for more information.

About the authors

Adam Palmer

Adam Palmer

Adam is a Principal Specialist Network Solutions Architect at AWS. Prior to joining AWS, Adam worked as an Architect in the Financial Service sector; specializing in Networking, VMware, Microsoft platform and End-User Compute solutions. In his spare time he can be found climbing mountain faces, wherever the weather is good!

Pablo Sánchez Carmona

Pablo Sánchez Carmona

Pablo is a Senior Network Specialist Solutions Architect at AWS, where he helps customers to design secure, resilient and cost-effective networks. When not talking about Networking, Pablo can be found playing basketball or video-games. He holds a MSc in Electrical Engineering from the Royal Institute of Technology (KTH), and a Master’s degree in Telecommunications Engineering from the Polytechnic University of Catalonia (UPC).