How to update Route53 records after EC2 instance restart

Amazon Route 53 is a highly available and scalable cloud Domain Name System (DNS) web service. If you are not using Elastic IPs for your EC2 instances, chances are stopping and starting the server will result in different IPs after the instance comes back online. If you have A records pointing to those IPs in Route53 you will need a way to update them.After the script is executed, it will automatically gather the new Public IP and update the DNS record for it in Route53.

 

2 thoughts on “How to update Route53 records after EC2 instance restart”

  1. [ec2-user@ip-172-31-22-106 ~]$ sudo ./ipregister.sh
    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 12 0 12 0 0 28 0 –:–:– –:–:– –:–:– 28
    Unable to locate credentials. You can configure credentials by running “aws configure”.
    usage: aws [options] [ …] [parameters]
    To see help text, you can run:

    aws help
    aws help
    aws help
    aws: error: argument –hosted-zone-id: expected one argument
    Updating resource record set

    {
    “Comment”: “Update record to reflect new public IP address”,
    “Changes”: [
    {
    “Action”: “UPSERT”,
    “ResourceRecordSet”: {
    “Name”: “ip-172-31-22-106.ap-south-1.compute.internal.”,
    “Type”: “”,
    “TTL”: 300,
    “ResourceRecords”: [
    {
    “Value”: “35.154.76.60”
    }
    ]
    }
    }
    ]
    }
    usage: aws [options] [ …] [parameters]
    To see help text, you can run:

    aws help
    aws help
    aws help
    aws: error: argument –hosted-zone-id: expected one argument
    usage: aws [options] [ …] [parameters]
    To see help text, you can run:

    aws help
    aws help
    aws help
    aws: error: argument –id: expected one argument
    Record updated!
    —————————————–
    Please help me with the error, Akhil

Leave a Reply

Your email address will not be published. Required fields are marked *