ArnComponents¶
-
class
aws_cdk.core.
ArnComponents
(*, resource, service, account=None, arn_format=None, partition=None, region=None, resource_name=None, sep=None)¶ Bases:
object
- Parameters
resource (
str
) – Resource type (e.g. “table”, “autoScalingGroup”, “certificate”). For some resource types, e.g. S3 buckets, this field defines the bucket name.service (
str
) – The service namespace that identifies the AWS product (for example, ‘s3’, ‘iam’, ‘codepipline’).account (
Optional
[str
]) – The ID of the AWS account that owns the resource, without the hyphens. For example, 123456789012. Note that the ARNs for some resources don’t require an account number, so this component might be omitted. Default: The account the stack is deployed to.arn_format (
Optional
[ArnFormat
]) – The specific ARN format to use for this ARN value. Default: - uses value ofsep
as the separator for formatting,ArnFormat.SLASH_RESOURCE_NAME
if that property was also not providedpartition (
Optional
[str
]) – The partition that the resource is in. For standard AWS regions, the partition is aws. If you have resources in other partitions, the partition is aws-partitionname. For example, the partition for resources in the China (Beijing) region is aws-cn. Default: The AWS partition the stack is deployed to.region (
Optional
[str
]) – The region the resource resides in. Note that the ARNs for some resources do not require a region, so this component might be omitted. Default: The region the stack is deployed to.resource_name (
Optional
[str
]) – Resource name or path within the resource (i.e. S3 bucket object key) or a wildcard such as"*"
. This is service-dependent.sep (
Optional
[str
]) – (deprecated) Separator between resource type and the resource. Can be either ‘/’, ‘:’ or an empty string. Will only be used if resourceName is defined. Default: ‘/’
- ExampleMetadata
infused
Example:
sub_zone = route53.PublicHostedZone(self, "SubZone", zone_name="sub.someexample.com" ) # import the delegation role by constructing the roleArn delegation_role_arn = Stack.of(self).format_arn( region="", # IAM is global in each partition service="iam", account="parent-account-id", resource="role", resource_name="MyDelegationRole" ) delegation_role = iam.Role.from_role_arn(self, "DelegationRole", delegation_role_arn) # create the record route53.CrossAccountZoneDelegationRecord(self, "delegate", delegated_zone=sub_zone, parent_hosted_zone_name="someexample.com", # or you can use parentHostedZoneId delegation_role=delegation_role )
Attributes
-
account
¶ The ID of the AWS account that owns the resource, without the hyphens.
For example, 123456789012. Note that the ARNs for some resources don’t require an account number, so this component might be omitted.
- Default
The account the stack is deployed to.
- Return type
Optional
[str
]
-
arn_format
¶ The specific ARN format to use for this ARN value.
- Default
uses value of
sep
as the separator for formatting,
ArnFormat.SLASH_RESOURCE_NAME
if that property was also not provided- Return type
Optional
[ArnFormat
]
-
partition
¶ The partition that the resource is in.
For standard AWS regions, the partition is aws. If you have resources in other partitions, the partition is aws-partitionname. For example, the partition for resources in the China (Beijing) region is aws-cn.
- Default
The AWS partition the stack is deployed to.
- Return type
Optional
[str
]
-
region
¶ The region the resource resides in.
Note that the ARNs for some resources do not require a region, so this component might be omitted.
- Default
The region the stack is deployed to.
- Return type
Optional
[str
]
-
resource
¶ Resource type (e.g. “table”, “autoScalingGroup”, “certificate”). For some resource types, e.g. S3 buckets, this field defines the bucket name.
- Return type
str
-
resource_name
¶ Resource name or path within the resource (i.e. S3 bucket object key) or a wildcard such as
"*"
. This is service-dependent.- Return type
Optional
[str
]
-
sep
¶ (deprecated) Separator between resource type and the resource.
Can be either ‘/’, ‘:’ or an empty string. Will only be used if resourceName is defined.
- Default
‘/’
- Deprecated
use arnFormat instead
- Stability
deprecated
- Return type
Optional
[str
]
-
service
¶ The service namespace that identifies the AWS product (for example, ‘s3’, ‘iam’, ‘codepipline’).
- Return type
str