Skip to content

Instantly share code, notes, and snippets.

@atr0s
Created September 21, 2020 00:33
Show Gist options
  • Save atr0s/06ecc48c921fcefc6a4ada4d177eff9b to your computer and use it in GitHub Desktop.
Save atr0s/06ecc48c921fcefc6a4ada4d177eff9b to your computer and use it in GitHub Desktop.
Convert AWS config into assume role links using gawk
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
@atr0s
Copy link
Author

atr0s commented Sep 21, 2020

it also works with awk

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment