1. Packages
  2. AWS Classic
  3. API Docs
  4. kms
  5. getAlias

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

AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi

aws.kms.getAlias

Explore with Pulumi AI

aws logo

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

AWS Classic v6.31.1 published on Thursday, Apr 18, 2024 by Pulumi

    Use this data source to get the ARN of a KMS key alias. By using this data source, you can reference key alias without having to hard code the ARN as input.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const s3 = aws.kms.getAlias({
        name: "alias/aws/s3",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    s3 = aws.kms.get_alias(name="alias/aws/s3")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := kms.LookupAlias(ctx, &kms.LookupAliasArgs{
    			Name: "alias/aws/s3",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var s3 = Aws.Kms.GetAlias.Invoke(new()
        {
            Name = "alias/aws/s3",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.kms.KmsFunctions;
    import com.pulumi.aws.kms.inputs.GetAliasArgs;
    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 s3 = KmsFunctions.getAlias(GetAliasArgs.builder()
                .name("alias/aws/s3")
                .build());
    
        }
    }
    
    variables:
      s3:
        fn::invoke:
          Function: aws:kms:getAlias
          Arguments:
            name: alias/aws/s3
    

    Using getAlias

    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 getAlias(args: GetAliasArgs, opts?: InvokeOptions): Promise<GetAliasResult>
    function getAliasOutput(args: GetAliasOutputArgs, opts?: InvokeOptions): Output<GetAliasResult>
    def get_alias(name: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetAliasResult
    def get_alias_output(name: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetAliasResult]
    func LookupAlias(ctx *Context, args *LookupAliasArgs, opts ...InvokeOption) (*LookupAliasResult, error)
    func LookupAliasOutput(ctx *Context, args *LookupAliasOutputArgs, opts ...InvokeOption) LookupAliasResultOutput

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

    public static class GetAlias 
    {
        public static Task<GetAliasResult> InvokeAsync(GetAliasArgs args, InvokeOptions? opts = null)
        public static Output<GetAliasResult> Invoke(GetAliasInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetAliasResult> getAlias(GetAliasArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:kms/getAlias:getAlias
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
    Name string
    Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
    name String
    Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
    name string
    Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
    name str
    Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)
    name String
    Display name of the alias. The name must start with the word "alias" followed by a forward slash (alias/)

    getAlias Result

    The following output properties are available:

    Arn string
    Amazon Resource Name(ARN) of the key alias.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    TargetKeyArn string
    ARN pointed to by the alias.
    TargetKeyId string
    Key identifier pointed to by the alias.
    Arn string
    Amazon Resource Name(ARN) of the key alias.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    TargetKeyArn string
    ARN pointed to by the alias.
    TargetKeyId string
    Key identifier pointed to by the alias.
    arn String
    Amazon Resource Name(ARN) of the key alias.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    targetKeyArn String
    ARN pointed to by the alias.
    targetKeyId String
    Key identifier pointed to by the alias.
    arn string
    Amazon Resource Name(ARN) of the key alias.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    targetKeyArn string
    ARN pointed to by the alias.
    targetKeyId string
    Key identifier pointed to by the alias.
    arn str
    Amazon Resource Name(ARN) of the key alias.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    target_key_arn str
    ARN pointed to by the alias.
    target_key_id str
    Key identifier pointed to by the alias.
    arn String
    Amazon Resource Name(ARN) of the key alias.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    targetKeyArn String
    ARN pointed to by the alias.
    targetKeyId String
    Key identifier pointed to by the alias.

    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.31.1 published on Thursday, Apr 18, 2024 by Pulumi