Class Arn

Amazon Resource Names (ARNs) uniquely identify AWS resources.

The following are the general formats for ARNs; the specific components and values used depend on the AWS service. To use an ARN, replace the italicized text in the example with your own information.

arn:partition:service:region:account-id:resource-id arn:partition:service:region:account-id:resource-type/resource-id arn:partition:service:region:account-id:resource-type:resource-id

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.

service The service namespace that identifies the AWS product (for example, Amazon S3, IAM, or Amazon RDS).

region The Region that the resource resides in. The ARNs for some resources do not require a Region, so this component might be omitted.

account-id The ID of the AWS account that owns the resource, without the hyphens. For example, 123456789012. The ARNs for some resources don't require an account number, so this component might be omitted.

resource or resource-type The content of this part of the ARN varies by service. A resource identifier can be the name or ID of the resource (for example, user/Bob or instance/i-1234567890abcdef0) or a resource path. For example, some resource identifiers include a parent resource (sub-resource-type/parent-resource/sub-resource) or a qualifier such as a version (resource-type:resource-name:qualifier).

https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html

Hierarchy

  • Arn

Implements

Constructors

  • Create an Arn object from ARN components

    Parameters

    • components: ArnInput

      ARN components object (scheme and partition are optional)

    Returns Arn

Properties

accountId: string

Account ID, e.g. "123456789"

partition: string

Partition, e.g. "aws" or "aws-cn"

region: string

Region, e.g. "us-west-1"

resourcePart: string

Resource, e.g. "my_bucket/my_key" or "layer:my_layer:42"

scheme: string

Scheme, e.g. "arn"

service: string

Service, e.g. "dynamodb"

Accessors

  • get resource(): ArnResource
  • Get a parsed representation of the resource part. Note that this property cannot be mutated, but if resourcePart is mutated, resource will reflect the change.

    Returns

    ArnResource

    Returns ArnResource

Methods

  • Format this Arn object into an ARN string.

    Returns

    string

    Returns string

  • Parse an ARN string into an Arn object

    Returns

    An Arn object, or null if the argument was invalid

    Parameters

    • s: string

      ARN string

    • Optional fail: false

      Whether to throw instead of returning null

    Returns null | Arn

  • Parse an ARN string into an Arn object, throwing an error if invalid

    Returns

    An Arn object

    Throws

    Error

    Parameters

    • s: string

      ARN string

    • fail: true

      Whether to throw instead of returning null

    Returns Arn

Generated using TypeDoc