Skip to content

Instantly share code, notes, and snippets.

@francoiscampbell
Created August 20, 2020 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save francoiscampbell/489f626f663952806d029df2ea85a4ba to your computer and use it in GitHub Desktop.
Save francoiscampbell/489f626f663952806d029df2ea85a4ba to your computer and use it in GitHub Desktop.
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.internal_id == "abc123"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment