This Python script is a simple yet powerful solution for migrating DNS records between two AWS accounts. It automates the process of transferring DNS records from an AWS Account A's hosted zone to an AWS Account B's hosted zone using AWS Route 53. This utility is perfect for those who need to quickly and accurately move DNS records between AWS accounts or consolidate infrastructure.
Note: If you want to transfer the domain registration from Account A to Account B, you can do so using the "Internal Transfer" function available inside Route 53. After the domain registration transfer is complete, you can use this script to move the DNS records.
- Transfers DNS records between AWS accounts
- Supports all record types except SOA and NS
- Built using the powerful boto3 library for seamless AWS integration
- Easily customizable to suit your specific needs
To use this script, you'll need:
- Python 3.6 or later
- boto3 - The AWS SDK for Python
- AWS credentials for both accounts, configured using AWS CLI or AWS SDK configuration files
- Clone this repository or download the script directly.
- Install the required dependency, boto3, if you haven't already.
pip install boto3
- Configure your AWS credentials for both accounts A and B using the AWS CLI or SDK.
- Open the script in your favorite text editor or IDE
- Replace the following placeholder values with your own:
aws_profile_name_account_a
with the AWS profile name for Account Aaws_profile_name_account_b
with the AWS profile name for Account B7hosted_zone_id_account_a
with the hosted zone ID for Account Anew_hosted_zone_id_account_b
with the new hosted zone ID for Account B
- Save your changes
- Run the script from the command line:
python dns_migration.py
- You should see the message "DNS records transferred successfully." after the script has completed. Verify the transfer by checking the DNS records in the new hosted zone in Account B
Feel free to open an issue or submit a pull request if you'd like to contribute to this project. All contributions are welcome!
This script is released under the MIT License. See the LICENSE file for more information.