Skip to content

Commit

Permalink
Add aws-sso run-command command
Browse files Browse the repository at this point in the history
* Allows running an aws-cli command against a given profile
  • Loading branch information
Stretch96 committed Nov 17, 2023
1 parent 00d5bc8 commit 5c7860c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions bin/aws-sso/run-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

# exit on failures
set -e
set -o pipefail

usage() {
echo "Usage: $(basename "$0") [OPTIONS]" 1>&2
echo " -h - help"
echo " -p <aws_sso_profile> - AWS SSO Profile"
exit 1
}

while getopts "p:h" opt; do
case $opt in
p)
AWS_SSO_PROFILE=$OPTARG
;;
h)
usage
;;
*)
usage
;;
esac
done

if [ -z "$AWS_SSO_PROFILE" ]
then
usage
fi
shift $((OPTIND-1))

export AWS_PROFILE="$AWS_SSO_PROFILE"
aws "$@"

0 comments on commit 5c7860c

Please sign in to comment.