How do I create a simple resource record set in Amazon Route 53 using the AWS CLI?
I want to use the AWS Command Line Interface (AWS CLI) to create a simple resource record set in Amazon Route 53.
"I want to use the AWS Command Line Interface (AWS CLI) to create a simple resource record set in Amazon Route 53.ResolutionTo create, delete, or change (upsert) a resource record set, use a ChangeResourceRecordSets request to the Route 53 API.Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent AWS CLI version.Create a ChangeResourceRecordSets requestYou can perform the following actions with a ChangeResourceRecordSets request:CREATE: Creates a record set with a specified value in the hosted zone.DELETE: Deletes a record set with a specified value in the hosted zone.UPSERT: Creates a new record set with a specified value, or updates a record set with a specified value if that record set already exists.To create, delete, or change a simple A record set, modify the following example JSON file (sample.json). The request’s body includes a list of change items, known as a change batch:{            "Comment": "CREATE/DELETE/UPSERT a record ",            "Changes": [{            "Action": "CREATE",                        "ResourceRecordSet": {                                    "Name": "a.example.com",                                    "Type": "A",                                    "TTL": 300,                                 "ResourceRecords": [{ "Value": "4.4.4.4"}]}}]}To create a resource record set for your domain in the hosted zone, use the Route 53 API with the command change-resource-record-sets. The sample.json file specifies the values for record creation:$ aws route53 change-resource-record-sets --hosted-zone-id ZXXXXXXXXXX --change-batch file://sample.jsonA Status of PENDING returns with the unique ID:$ aws route53 change-resource-record-sets --hosted-zone-id ZXXXXXXXXXXX --change-batch file://sample.json{    "ChangeInfo": {        "Status": "PENDING",         "Comment": "optional comment about the changes in this change batch request",         "SubmittedAt": "2018-07-10T19:39:37.757Z",         "Id": "/change/C3QYC83OA0KX5K"    }}If you don't see this status with the ID, then there's an error in the JSON file.To check the status of the changes, use the API call get-change with the Id value from your change-resource-record-sets response:PENDING indicates that the changes in this request aren't yet propagated to all Route 53 DNS servers. This is the initial status of all change batch requests.INSYNC indicates that the changes are propagated to all Route 53 DNS servers.Here's a PENDING status before propagation:aws route53  get-change --id /change/C3QYC83OA0KX5K{    "ChangeInfo": {        "Status": "PENDING",         "Comment": "optional comment about the changes in this change batch request",         "SubmittedAt": "2018-07-10T19:39:37.757Z",         "Id": "/change/C3QYC83OA0KX5K"    }}Here's an INSYNC status after propagation:$ aws route53  get-change --id /change/C3QYC83OA0KX5K{    "ChangeInfo": {        "Status": "INSYNC",         "Comment": "optional comment about the changes in this change batch request",         "SubmittedAt": "2018-07-10T19:39:37.757Z",         "Id": "/change/C3QYC83OA0KX5K"    }Create concurrent requestsYou must use separate Action keys for each concurrent request. For example, you can't create an A record and an MX record in one request. Instead, you must create two record sets for the same domain name with the following format:{                "Comment": "CREATE/DELETE/UPDATE",                 "Changes": [ {                             "Action": "CREATE",                            "ResourceRecordSet": {                                "Name": "a.example.com",                                    "Type": "A",                                     "TTL": 300,                                  "ResourceRecords": [{"Value": "5.5.5.5"}]                            }},{                            "Action": "CREATE",                            "ResourceRecordSet": {                                 "Name": "a.example.com",                                 "Type": "MX",                                  "TTL": 300,                                  "ResourceRecords": [{"Value": "10 example.com"}]                           }}]}Related informationHow do I troubleshoot errors that I received while creating Route 53 resource record sets using the AWS CLI?Follow"