Created
April 16, 2013 14:19
-
-
Save thalweg/5396274 to your computer and use it in GitHub Desktop.
Wrapper for aws-cli validate-template
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
#!/usr/bin/env bash | |
# A simple wrapper for validating locally-stored CloudFormation templates | |
# Requires aws-cli <https://github.com/aws/aws-cli> | |
usage(){ | |
echo "$(basename $0) <cfn.json>" | |
} | |
if (( $# == 0 )); then | |
usage | |
exit 1 | |
fi | |
# Store the first arg, then shift params in case we need to pass onto aws | |
file="$1" | |
shift | |
if [[ -f "$file" && -r "$file" ]]; then | |
aws cloudformation validate-template --template-body "$(cat "$file")" "$@" | |
exit $? | |
else | |
echo "$file does not exist or is not readable" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment