AWS Urns

A dataclass for building and querying AWS URNs.

AWS URNs are a standardised string format (name borrowed from Pulumi) which provide all the information required to find a resource in AWS, whereas AWS ARNs do not always provide this information.

# Format
'urn:aws:<account_id>:<region>:<service>:<resource_type>:<resource_id>'
# e.g.
'urn:aws:111111111111:eu-west-2:ec2:vpc:vpc-11111111'

Example

>>> from cloudwanderer import AwsUrn
>>> AwsUrn.from_string('urn:aws:111111111111:eu-west-2:ec2:vpc:vpc-11111111')
AwsUrn(account_id='111111111111', region='eu-west-2', service='ec2', resource_type='vpc', resource_id='vpc-11111111')
class AwsUrn(account_id, region, service, resource_type, resource_id)

A dataclass for building and querying AWS URNs.

Parameters
  • account_id (str) – AWS Account ID (e.g. 111111111111).

  • region (str) – AWS region (e.g. eu-west-1).

  • service (str) – AWS Service (e.g. ec2).

  • resource_type (str) – AWS Resource Type (e.g. instance)

  • resource_id (str) – AWS Resource Id (e.g. i-11111111)

classmethod from_string(urn_string)

Create an AwsUrn Object from an AwsUrn string.

Parameters

urn_string (str) –

Return type

cloudwanderer.aws_urn.AwsUrn