Introduction
When hosting services on Amazon Web Services (AWS), ensuring your website or applications remain accessible, even if your IP address changes, is crucial. This guide will introduce you to ddns-route53, a tool that simplifies Dynamic DNS (Domain Name System) management on AWS. Imagine it as your helpful assistant, keeping track of your changing home address and telling everyone where to find you!
Prerequisites
Before diving in, make sure you've set up a Route 53 Hosted Zone as a Public Hosted Zone and configured Amazon name servers with your domain name registrar. Also, follow these steps to grant the necessary permissions to ddns-route53:
Create a Policy:
Go to the IAM Policies page and click on Create Policy.
Select the JSON tab and paste the following content:
{ "Version": "2012-10-17", "Statement": [ { "Action": [ "route53:ChangeResourceRecordSets", "route53:ListResourceRecordSets" ], "Effect": "Allow", "Resource": "arn:aws:route53:::hostedzone/<HOSTED_ZONE_ID>" } ] }
Replace
<HOSTED_ZONE_ID>
with your specific Hosted Zone ID from the Route 53 Hosted Zones page.Enter a Policy Name and click Create Policy.
Create an IAM User:
Go to the IAM Users page and click the Create User button.
Enter a User name, and click Next: Permissions (No need to check Provide user access to the AWS Management Console - optional).
Choose the option to Attach existing policies directly.
In the search field, enter the name of the policy you created earlier and click Next: Review.
Click Create User.
After creating the user, you will be taken back to the list of users in your IAM dashboard.
Generate Access Keys:
Click on the newly created user to access their settings.
Go to the "Security Credentials" tab.
In the "Access keys" section, click "Create Access Key".
You can choose "Other" for the access key type and optionally set a description tag.
Click "Create access key".
Save Access Key Details:
- After creating the access key, a confirmation window will appear. Click "Download .csv file" to save the access key details securely. This CSV file contains your Access Key ID and Secret Access Key. Keep these credentials safe, as you will need them for the next step.
Running ddns-route53 with Docker
Install Docker:
- If you haven’t already, install Docker on your computer.
Create a Configuration File:
Replace the environment variables (YOUR_ACCESS_KEY_ID, YOUR_SECRET_ACCESS_KEY, YOUR_HOSTED_ZONE_ID, ddns.example.com) to specify your AWS details and how often ddns-route53 should check for address changes (30 minutes by default). Save it in a file named
docker-compose.yml
.version: "3.5" services: ddns-route53: image: crazymax/ddns-route53:latest container_name: ddns-route53 environment: - "TZ=US/Mountain" - "SCHEDULE=*/30 * * * *" - "LOG_LEVEL=info" - "LOG_JSON=false" - "DDNSR53_CREDENTIALS_ACCESSKEYID=YOUR_ACCESS_KEY_ID" - "DDNSR53_CREDENTIALS_SECRETACCESSKEY=YOUR_SECRET_ACCESS_KEY" - "DDNSR53_ROUTE53_HOSTEDZONEID=YOUR_HOSTED_ZONE_ID" - "DDNSR53_ROUTE53_RECORDSSET_0_NAME=ddns.example.com." - "DDNSR53_ROUTE53_RECORDSSET_0_TYPE=A" - "DDNSR53_ROUTE53_RECORDSSET_0_TTL=300" restart: always
Start ddns-route53:
- Run the following command in the same folder as your
docker-compose.yml
file:
- Run the following command in the same folder as your
docker-compose up -d
docker-compose logs -f
Congratulations! You've now set up your Dynamic DNS on AWS using ddns-route53. Your website or services will remain accessible to people worldwide, even if your internet address changes. With ddns-route53, your online presence stays strong and consistent, ensuring seamless access for your users. For further guidance and advanced usage, refer to the official ddns-route53 repository. Happy hosting!