AWS Classic

v4.30.0 published on Tuesday, Nov 30, 2021 by Pulumi

getArn

Parses an Amazon Resource Name (ARN) into its constituent parts.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var dbInstance = Output.Create(Aws.GetArn.InvokeAsync(new Aws.GetArnArgs
        {
            Arn = "arn:aws:rds:eu-west-1:123456789012:db:mysql-db",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetArn(ctx, &GetArnArgs{
			Arn: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

db_instance = aws.get_arn(arn="arn:aws:rds:eu-west-1:123456789012:db:mysql-db")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const dbInstance = pulumi.output(aws.getArn({
    arn: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db",
}));

Using getArn

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getArn(args: GetArnArgs, opts?: InvokeOptions): Promise<GetArnResult>
function getArnOutput(args: GetArnOutputArgs, opts?: InvokeOptions): Output<GetArnResult>
def get_arn(arn: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> GetArnResult
def get_arn_output(arn: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetArnResult]
func GetArn(ctx *Context, args *GetArnArgs, opts ...InvokeOption) (*GetArnResult, error)
func GetArnOutput(ctx *Context, args *GetArnOutputArgs, opts ...InvokeOption) GetArnResultOutput

> Note: This function is named GetArn in the Go SDK.

public static class GetArn 
{
    public static Task<GetArnResult> InvokeAsync(GetArnArgs args, InvokeOptions? opts = null)
    public static Output<GetArnResult> Invoke(GetArnInvokeArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Arn string
The ARN to parse.
Arn string
The ARN to parse.
arn string
The ARN to parse.
arn str
The ARN to parse.

getArn Result

The following output properties are available:

Account string
The ID of the AWS account that owns the resource, without the hyphens.
Arn string
Id string
The provider-assigned unique ID for this managed resource.
Partition string
The partition that the resource is in.
Region string
The region the resource resides in. Note that the ARNs for some resources do not require a region, so this component might be omitted.
Resource string
The content of this part of the ARN varies by service. It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS database —followed by a slash (/) or a colon (:), followed by the resource name itself.
Service string
The service namespace that identifies the AWS product.
Account string
The ID of the AWS account that owns the resource, without the hyphens.
Arn string
Id string
The provider-assigned unique ID for this managed resource.
Partition string
The partition that the resource is in.
Region string
The region the resource resides in. Note that the ARNs for some resources do not require a region, so this component might be omitted.
Resource string
The content of this part of the ARN varies by service. It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS database —followed by a slash (/) or a colon (:), followed by the resource name itself.
Service string
The service namespace that identifies the AWS product.
account string
The ID of the AWS account that owns the resource, without the hyphens.
arn string
id string
The provider-assigned unique ID for this managed resource.
partition string
The partition that the resource is in.
region string
The region the resource resides in. Note that the ARNs for some resources do not require a region, so this component might be omitted.
resource string
The content of this part of the ARN varies by service. It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS database —followed by a slash (/) or a colon (:), followed by the resource name itself.
service string
The service namespace that identifies the AWS product.
account str
The ID of the AWS account that owns the resource, without the hyphens.
arn str
id str
The provider-assigned unique ID for this managed resource.
partition str
The partition that the resource is in.
region 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.
resource str
The content of this part of the ARN varies by service. It often includes an indicator of the type of resource—for example, an IAM user or Amazon RDS database —followed by a slash (/) or a colon (:), followed by the resource name itself.
service str
The service namespace that identifies the AWS product.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.