Closed mbarneyjr closed 7 years ago
AWSUME_
to all variables, since the user will have to run this script sourced, we don't want any variable interference with any other possible running scripts.return
command, since you won't be returning from a function, you will return from the script, and not exit the terminal itself.aws sts get-session-token
command by using the --query
option and treating AWSUME_SessionText
as an array, so that the script looks cleaner.aws configure get
commands, as they are slow and take up a lot of time.
AWSume for Bash
I recreated the AWSume script for Bash, starting from scratch, but referencing the old AWSume script for Bash. It now works more like the AWSume PowerShell script, but Linux friendly.
This script is more modular, emulating the PowerShell script.
There are three command-line options this script accepts:
-s
,-r
, and-d
:-s
displays, to the console, the commands required to assume the role just assumed by the script.-r
will refresh the session no matter what. The user will have to enter their MFA code even if they just used the script on the same profile.-d
will assume the role of the default profile.It is used in a similar fashion to the PowerShell script, too. To use this script,
awsume [ profile_name ] [ flags ]