Skip to content

Instantly share code, notes, and snippets.

View afosterw's full-sized avatar

Areth Foster-Webster afosterw

View GitHub Profile
@afosterw
afosterw / parse_arn.py
Created February 14, 2018 20:21 — forked from gene1wood/parse_arn.py
Parse an AWS ARN (Amazon Resource Name) into it's constituent elements
def parse_arn(arn):
# http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
elements = arn.split(':')
result = {'arn': elements[0],
'partition': elements[1],
'service': elements[2],
'region': elements[3],
'account': elements[4]
}
if len(elements) == 7: