Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sjmcgrath/6a83b4f0d909d0a31baaffe648a04560 to your computer and use it in GitHub Desktop.
Save sjmcgrath/6a83b4f0d909d0a31baaffe648a04560 to your computer and use it in GitHub Desktop.
Deletes a CloudFront Origin Access Identity
#!/bin/bash -e
[[ $# -eq 1 ]] || {
cat <<EOF >&2
Usage. ${0##*/} OAI-Id
EOF
exit 1
}
ETAG=$( aws cloudfront get-cloud-front-origin-access-identity --id "$1" --query 'ETag' | sed 's/"//g')
aws cloudfront delete-cloud-front-origin-access-identity --id "$1" --if-match "$ETAG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment