1. Packages
  2. AWS
  3. API Docs
  4. getArn
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.getArn

Explore with Pulumi AI

AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

Parses an ARN into its constituent parts.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

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

db_instance = aws.get_arn(arn="arn:aws:rds:eu-west-1:123456789012:db:mysql-db")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := aws.GetArn(ctx, &aws.GetArnArgs{
			Arn: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var dbInstance = Aws.GetArn.Invoke(new()
    {
        Arn = "arn:aws:rds:eu-west-1:123456789012:db:mysql-db",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.AwsFunctions;
import com.pulumi.aws.inputs.GetArnArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var dbInstance = AwsFunctions.getArn(GetArnArgs.builder()
            .arn("arn:aws:rds:eu-west-1:123456789012:db:mysql-db")
            .build());

    }
}
Copy
variables:
  dbInstance:
    fn::invoke:
      function: aws:getArn
      arguments:
        arn: arn:aws:rds:eu-west-1:123456789012:db:mysql-db
Copy

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>
Copy
def get_arn(arn: Optional[str] = None,
            id: Optional[str] = None,
            opts: Optional[InvokeOptions] = None) -> GetArnResult
def get_arn_output(arn: Optional[pulumi.Input[str]] = None,
            id: Optional[pulumi.Input[str]] = None,
            opts: Optional[InvokeOptions] = None) -> Output[GetArnResult]
Copy
func GetArn(ctx *Context, args *GetArnArgs, opts ...InvokeOption) (*GetArnResult, error)
func GetArnOutput(ctx *Context, args *GetArnOutputArgs, opts ...InvokeOption) GetArnResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetArnResult> getArn(GetArnArgs args, InvokeOptions options)
public static Output<GetArnResult> getArn(GetArnArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:index/getArn:getArn
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Arn This property is required. string
ARN to parse.
Id string
Arn This property is required. string
ARN to parse.
Id string
arn This property is required. String
ARN to parse.
id String
arn This property is required. string
ARN to parse.
id string
arn This property is required. str
ARN to parse.
id str
arn This property is required. String
ARN to parse.
id String

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
Partition string
Partition that the resource is in.
Region string
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
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
Partition string
Partition that the resource is in.
Region string
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
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
partition String
Partition that the resource is in.
region String
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
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
partition string
Partition that the resource is in.
region string
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
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
partition str
Partition that the resource is in.
region str
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
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.
account String
The ID of the AWS account that owns the resource, without the hyphens.
arn String
id String
partition String
Partition that the resource is in.
region String
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
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.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi