Skip to content

Instantly share code, notes, and snippets.

@mattsan
Created August 22, 2020 09:24
Show Gist options
  • Save mattsan/ab4e3dce35a6c0bd37c1fa61a3e2a70f to your computer and use it in GitHub Desktop.
Save mattsan/ab4e3dce35a6c0bd37c1fa61a3e2a70f to your computer and use it in GitHub Desktop.
AWS Events の内容を一覧する
#!/bin/sh
if [ "$1" = "production" ]; then
STAGE=production
elif [ "$1" = "staging" ] || [ "$1" = "" ]; then
STAGE=staging
else
cat <<EOS
usage:
bin/events [stage]
stage: 'production' or 'staging' (default: 'staging')
EOS
exit 1
fi
QUERY=Rules[].[State,Name,Description]
echo
echo ' State | Name | Description'
echo '-----------|---------------------------------------------------------|--------------------'
aws events list-rules \
--profile "$STAGE" \
--query "$QUERY" \
--output text \
| awk '{ printf(" %-8s | %-55s | %s\n", $1, $2, $3) }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment