Created
September 21, 2020 00:33
-
-
Save atr0s/06ecc48c921fcefc6a4ada4d177eff9b to your computer and use it in GitHub Desktop.
Convert AWS config into assume role links using gawk
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
gawk 'BEGIN { RS = "\n\n\\[" } {split($2,p,"\]",seps); split($5,a,":",seps); split($5,b,"/",seps) ; if (a[5]!="") printf("https://signin.aws.amazon.com/switchrole?account=%s&displayName=%s&roleName=%s\n",a[5],p[1],b[2])}' ~/.aws/config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it also works with awk