Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sjmcgrath/0ad55ae93138517964ff008ba9708921 to your computer and use it in GitHub Desktop.
Save sjmcgrath/0ad55ae93138517964ff008ba9708921 to your computer and use it in GitHub Desktop.
Creates a CloudFront Origin Access Identity
#!/bin/bash -e
[[ $# -le 2 ]] || {
cat <<EOF >&2
Usage: ${0##*/} environment application
Parameters:
environment - dev, staging, production, etc
application - name of application
Output: CloudFront Origin Access Identity Id
EOF
exit 1
}
COMMENT=$2-$1-OAI
CALLER_REFERENCE=${COMMENT}
aws cloudfront create-cloud-front-origin-access-identity \
--cloud-front-origin-access-identity-config "Comment=${COMMENT},CallerReference=${CALLER_REFERENCE}" \
--query 'CloudFrontOriginAccessIdentity.Id' \
| sed 's/"//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment