・ Windows terminal (author is win10) ・ Python installed
Set records on Route 53 on the command line using AWS-CLI
Check if python is included (image is 3.8.1)
>python --version
Python 3.8.1
> pip3 install awscli
where /R c:\ aws
Press the Windows button and enter "environment variables" in the search box to search and set the Path displayed above
[Example] Display result: In the case of "c: [user directory] \ Python \ Python37 \ Scripts \ aws" Settings: c: [userdirectory] \ Python \ Python37 \ Scripts ** * There was also an option to set the PATH when installing python. ** **
>aws --version
aws-cli/1.18.3 Python/3.8.1 Windows/10 botocore/1.15.3
Download accessKeys.csv.
> aws configure
Enter the following.
> AWS Access Key ID [None]: Enter the Access key ID of the csv file
> Secret access key:Enter the Secret access key in the csv file
> Default region name [None]: ap-northeast-1
> Default output format [None]:json
{
"Comment": "CREATE/DELETE/UPSERT a record ",
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "a.example.com",
"Type": "A",
"TTL": 300,
"ResourceRecords": [{ "Value": "4.4.4.4"}]
}}]
}
Use the command ** change-resource-record-sets ** to create a resource record set for your domain in the hosted zone. The value for creating the record is specified in the sample.json file.
aws route53 change-resource-record-sets --hosted-zone-id ZXXXXXXXXXX --change-batch file://sample.json
If there are no errors in the JSON file, PENDING is returned as the status with a 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"
}
}
To check the status of changes, use the Id value in the change-resource-record-sets response in the API call get-change.
aws route53 get-change --id /change/C3QYC83OA0KX5K
· *** PENDING *** indicates that the change in this request has not yet been propagated to the server. · *** INSYNC *** indicates that changes have been propagated to the server.
Recommended Posts