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 URN
>>> URN.from_string('urn:aws:111111111111:eu-west-2:ec2:vpc:vpc-11111111')
URN(account_id='111111111111', region='eu-west-2', service='ec2', resource_type='vpc', resource_id='vpc-11111111')
-
class
URN
(account_id, region, service, resource_type, resource_id, cloud_name=None)¶ A dataclass for building and querying AWS URNs.
-
__init__
(account_id, region, service, resource_type, resource_id, cloud_name=None)¶ Initialise an AWS Urn.
- 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
)cloud_name (str) – The name of the cloud this resource exists in (defaults to
'aws'
)
- Return type
None
-
classmethod
from_string
(urn_string)¶ Create an URN Object from an URN string.
- Parameters
urn_string (str) – The string version of an AWSUrn to convert into an object.
- Returns
The instantiated AWS URN.
- Return type
-
property
is_subresource
¶ Return whether or not this urn pertains to a subresource.
A subresource is a resource which does not have its own cloud provider identity and is only accessible by referring to a parent resource.
-