Skip to content

Amazon Web Services - Useful CLI commands

Route 53

Update a Route 53 record to the public IP address

$ aws route53 change-resource-record-sets --hosted-zone-id HOSTEDZONEID --change-batch "{\"Changes\":[{\"Action\":\"UPSERT\",\"ResourceRecordSet\":{\"Name\":\"server.example.com.\",\"Type\":\"A\",\"TTL\":60,\"ResourceRecords\":[{\"Value\":\"$(curl -s http://checkip.amazonaws.com)\"}]}}]}"

Cloudfront

Find a distribution for an alias

$ aws cloudfront list-distributions \
    --query "DistributionList.Items[*].{id:Id,alias:Aliases.Items[*]}[?contains(alias,'www.massyn.net')].id" \
    --output text