Created
September 25, 2024 01:57
-
-
Save perpil/11623908ed057061a451b875383f2784 to your computer and use it in GitHub Desktop.
AWS CLI alias for printing account alias and important part of ARN of current credentials
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
| [toplevel] | |
| whoami = | |
| !f() { | |
| echo `als=$(aws iam list-account-aliases --query 'AccountAliases[0]' --output text) && \ | |
| echo "\033[0;33m$als\033[0m:";`\ | |
| `callerid=$(aws sts get-caller-identity --query 'Arn' --output text) && \ | |
| (echo $callerid | cut -d: -f5-6)` | |
| }; f |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: Write file to
~/.aws/cli/aliasand runaws whoami