Skip to content

Instantly share code, notes, and snippets.

@mwnorman
Created August 14, 2016 15:01
Show Gist options
  • Save mwnorman/fb71f8b010a17e69a96381f5188e166d to your computer and use it in GitHub Desktop.
Save mwnorman/fb71f8b010a17e69a96381f5188e166d to your computer and use it in GitHub Desktop.
parse aws iam arn
#!/bin/sh
aws --profile $1 iam get-user | jq '.User | {accountName: .UserName, accountId : .Arn | match("(arn:aws:iam::)(\\d{12})").captures[1].string }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment