Created
April 26, 2017 21:46
-
-
Save tfentonz/4783e0fd061ff9dbba3e86e7a2ac3263 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| # Requires an S3 bucket with website redirect for zone apx | |
| # e.g. example.com -> www.example.com | |
| # See http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region | |
| # for alias target hosted zone ID. | |
| hosted_zone_id="ZABCDEFGHIJ1K" | |
| alias_target_hosted_zone_id="Z1WCIGYICN2BYD" | |
| aws route53 change-resource-record-sets \ | |
| --hosted-zone-id "$hosted_zone_id" \ | |
| --region "ap-southeast-2" \ | |
| --change-batch "{ | |
| \"Changes\": [ | |
| { | |
| \"Action\": \"CREATE\", | |
| \"ResourceRecordSet\": { | |
| \"Name\": \"example.com\", | |
| \"Type\": \"A\", | |
| \"AliasTarget\": { | |
| \"HostedZoneId\": \"$alias_target_hosted_zone_id\", | |
| \"DNSName\": \"s3-website-ap-southeast-2.amazonaws.com.\", | |
| \"EvaluateTargetHealth\": false | |
| } | |
| } | |
| } | |
| ] | |
| }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment