Last active
April 24, 2019 23:07
-
-
Save uemuraj/7ea92eaa1964b20e9b7b4b2ac71e08a0 to your computer and use it in GitHub Desktop.
aws route53 change-resource-record-sets をラップする簡単なシェルスクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN=$1 | |
ZONE_ID=$(aws route53 list-hosted-zones-by-name --dns-name ${DOMAIN:?} --output text | grep -o -P "/hostedzone/[A-Z0-9]+") | |
CHANGE_ID=$(aws route53 change-resource-record-sets --hosted-zone-id ${ZONE_ID:?} --change-batch file:///dev/stdin --output text | grep -o -P "/change/[A-Z0-9]+") | |
if [ -z $CHANGE_ID ]; then | |
exit 1 | |
fi | |
while aws route53 get-change --id $CHANGE_ID --output text | grep PENDING | |
do | |
sleep 10s | |
done | |
aws route53 get-change --id $CHANGE_ID --output text | grep INSYNC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": [ | |
"route53:GetHostedZone", | |
"route53:ListHostedZonesByName", | |
"route53:ChangeResourceRecordSets", | |
"route53:GetChange" | |
], | |
"Resource": [ | |
"*" | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
こんな感じで使えます: