Skip to main content

A Python library for parsing AWS ARNs

Project description

arn

A Python library for parsing AWS ARNs.

Installation

To install, just run

pip install arn

or add the library to your setup.py / requirements.txt.

Usage

Given an ARN for a particular AWS resource, parse it with the appropriate class:

from arn.elbv2 import TargetGroupArn

target_group_arn_str = "arn:aws:elasticloadbalancing:us-east-1:123456789012:targetgroup/foo-bar/abc123"
target_group_arn = TargetGroupArn(target_group_arn_str)

# use the ARN instance's __str__ to format the ARN back into a string 
assert str(target_group_arn) == target_group_arn_str

# common attributes
assert target_group_arn.partition == "aws"
assert target_group_arn.service == "elasticloadbalancing"
assert target_group_arn.region == "us-east-1"
assert target_group_arn.account == "123456789012"

# attributes specific to the type of AWS resource
assert target_group_arn.name == "foo-bar"
assert target_group_arn.id == "abc123"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

arn-0.1.5-py3-none-any.whl (7.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page