Pages

Tuesday, May 14, 2024

How to Create Cross-Account Alias Records in AWS Route 53 for an ELB

Managing DNS records across multiple AWS accounts can be challenging, especially when dealing with resources like Elastic Load Balancers (ELBs). If you have a domain hosted in one AWS account and an ELB in another, you might wonder how to create an alias record that links the two. Fortunately, AWS Route 53 supports cross-account alias records, making this process straightforward. Here’s how you can set it up.

Scenario

Account A: Contains the Route 53 hosted zone for your domain.
Account B: Contains the ELB.

Step-by-Step Guide

Step 1: Obtain the ELB DNS NameLog in to AWS Account B.

  1. Log in to AWS Account B.
  2. Navigate to the EC2 Console: Go to the EC2 dashboard.
  3. In the navigation pane, select Load Balancers.
  4. Copy the DNS Name of the ELB:Select your target ELB.
  5. Note down its DNS name (e.g., my-elb-1234567890.us-west-2.elb.amazonaws.com).

Step 2: Create Alias Record in Route 53

  • Log in to AWS Account A.
  • Open the Route 53 Console: Go to the Route 53 dashboard.
  • Navigate to Hosted Zones and select the hosted zone for your domain.
    • Create a New Record:Click on Create Record.
    • Choose Simple Routing.
      • Configure the Alias Record:Record Name: Leave this blank if you are configuring the zone apex (e.g., example.com), or enter the desired subdomain (e.g., www).
      • Record Type: Choose A - IPv4 address.
      • Alias: Select Yes.
      • Alias Target: Paste the ELB DNS name copied from Account B.
      • AWS will automatically resolve the Alias Hosted Zone ID associated with the ELB DNS name.
    • Save the Record:Click Create records to save your changes.

Step 3: Verify the Configuration

Check the DNS Record:Use a DNS query tool like dig or nslookup to verify that the domain points to the ELB

dig example.com

The response should include the ELB DNS name.


Updated AWS Documentation

AWS has updated its documentation to clarify the process of creating cross-account alias records. You can refer to the AWS Route 53 Developer Guide for detailed information.
Conclusion

By following these steps, you can successfully create an alias record in AWS Route 53 that points to an ELB in another AWS account. This method ensures seamless integration of your domain with resources across multiple AWS accounts, enhancing your infrastructure’s flexibility and security.

No comments:

Post a Comment