1. Packages
  2. AWS Classic
  3. API Docs
  4. getArn

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.0 published on Saturday, Dec 2, 2023 by Pulumi

aws.getArn

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.13.0 published on Saturday, Dec 2, 2023 by Pulumi

    Parses an ARN into its constituent parts.

    Example Usage

    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",
        });
    
    });
    
    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
    	})
    }
    
    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());
    
        }
    }
    
    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 = aws.getArn({
        arn: "arn:aws:rds:eu-west-1:123456789012:db:mysql-db",
    });
    
    variables:
      dbInstance:
        fn::invoke:
          Function: aws:getArn
          Arguments:
            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,
                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]
    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)
    }
    public static CompletableFuture<GetArnResult> getArn(GetArnArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:index/getArn:getArn
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Arn string

    ARN to parse.

    Id string
    Arn string

    ARN to parse.

    Id string
    arn String

    ARN to parse.

    id String
    arn string

    ARN to parse.

    id string
    arn str

    ARN to parse.

    id str
    arn 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 logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.13.0 published on Saturday, Dec 2, 2023 by Pulumi