1. Packages
  2. AWS Classic
  3. API Docs
  4. lambda
  5. Alias

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

AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi

aws.lambda.Alias

Explore with Pulumi AI

aws logo

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

AWS Classic v6.45.0 published on Tuesday, Jul 16, 2024 by Pulumi

    Creates a Lambda function alias. Creates an alias that points to the specified Lambda function version.

    For information about Lambda and how to use it, see What is AWS Lambda? For information about function aliases, see CreateAlias and AliasRoutingConfiguration in the API docs.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const testLambdaAlias = new aws.lambda.Alias("test_lambda_alias", {
        name: "my_alias",
        description: "a sample description",
        functionName: lambdaFunctionTest.arn,
        functionVersion: "1",
        routingConfig: {
            additionalVersionWeights: {
                "2": 0.5,
            },
        },
    });
    
    import pulumi
    import pulumi_aws as aws
    
    test_lambda_alias = aws.lambda_.Alias("test_lambda_alias",
        name="my_alias",
        description="a sample description",
        function_name=lambda_function_test["arn"],
        function_version="1",
        routing_config={
            "additionalVersionWeights": {
                "2": 0.5,
            },
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lambda"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := lambda.NewAlias(ctx, "test_lambda_alias", &lambda.AliasArgs{
    			Name:            pulumi.String("my_alias"),
    			Description:     pulumi.String("a sample description"),
    			FunctionName:    pulumi.Any(lambdaFunctionTest.Arn),
    			FunctionVersion: pulumi.String("1"),
    			RoutingConfig: &lambda.AliasRoutingConfigArgs{
    				AdditionalVersionWeights: pulumi.Float64Map{
    					"2": pulumi.Float64(0.5),
    				},
    			},
    		})
    		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 testLambdaAlias = new Aws.Lambda.Alias("test_lambda_alias", new()
        {
            Name = "my_alias",
            Description = "a sample description",
            FunctionName = lambdaFunctionTest.Arn,
            FunctionVersion = "1",
            RoutingConfig = new Aws.Lambda.Inputs.AliasRoutingConfigArgs
            {
                AdditionalVersionWeights = 
                {
                    { "2", 0.5 },
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lambda.Alias;
    import com.pulumi.aws.lambda.AliasArgs;
    import com.pulumi.aws.lambda.inputs.AliasRoutingConfigArgs;
    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) {
            var testLambdaAlias = new Alias("testLambdaAlias", AliasArgs.builder()
                .name("my_alias")
                .description("a sample description")
                .functionName(lambdaFunctionTest.arn())
                .functionVersion("1")
                .routingConfig(AliasRoutingConfigArgs.builder()
                    .additionalVersionWeights(Map.of("2", 0.5))
                    .build())
                .build());
    
        }
    }
    
    resources:
      testLambdaAlias:
        type: aws:lambda:Alias
        name: test_lambda_alias
        properties:
          name: my_alias
          description: a sample description
          functionName: ${lambdaFunctionTest.arn}
          functionVersion: '1'
          routingConfig:
            additionalVersionWeights:
              '2': 0.5
    

    Create Alias Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new Alias(name: string, args: AliasArgs, opts?: CustomResourceOptions);
    @overload
    def Alias(resource_name: str,
              args: AliasArgs,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Alias(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              function_name: Optional[str] = None,
              function_version: Optional[str] = None,
              description: Optional[str] = None,
              name: Optional[str] = None,
              routing_config: Optional[_lambda_.AliasRoutingConfigArgs] = None)
    func NewAlias(ctx *Context, name string, args AliasArgs, opts ...ResourceOption) (*Alias, error)
    public Alias(string name, AliasArgs args, CustomResourceOptions? opts = null)
    public Alias(String name, AliasArgs args)
    public Alias(String name, AliasArgs args, CustomResourceOptions options)
    
    type: aws:lambda:Alias
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args AliasArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var examplealiasResourceResourceFromLambdaalias = new Aws.Lambda.Alias("examplealiasResourceResourceFromLambdaalias", new()
    {
        FunctionName = "string",
        FunctionVersion = "string",
        Description = "string",
        Name = "string",
        RoutingConfig = new Aws.Lambda.Inputs.AliasRoutingConfigArgs
        {
            AdditionalVersionWeights = 
            {
                { "string", 0 },
            },
        },
    });
    
    example, err := lambda.NewAlias(ctx, "examplealiasResourceResourceFromLambdaalias", &lambda.AliasArgs{
    	FunctionName:    pulumi.String("string"),
    	FunctionVersion: pulumi.String("string"),
    	Description:     pulumi.String("string"),
    	Name:            pulumi.String("string"),
    	RoutingConfig: &lambda.AliasRoutingConfigArgs{
    		AdditionalVersionWeights: pulumi.Float64Map{
    			"string": pulumi.Float64(0),
    		},
    	},
    })
    
    var examplealiasResourceResourceFromLambdaalias = new Alias("examplealiasResourceResourceFromLambdaalias", AliasArgs.builder()
        .functionName("string")
        .functionVersion("string")
        .description("string")
        .name("string")
        .routingConfig(AliasRoutingConfigArgs.builder()
            .additionalVersionWeights(Map.of("string", 0))
            .build())
        .build());
    
    examplealias_resource_resource_from_lambdaalias = aws.lambda_.Alias("examplealiasResourceResourceFromLambdaalias",
        function_name="string",
        function_version="string",
        description="string",
        name="string",
        routing_config={
            "additionalVersionWeights": {
                "string": 0,
            },
        })
    
    const examplealiasResourceResourceFromLambdaalias = new aws.lambda.Alias("examplealiasResourceResourceFromLambdaalias", {
        functionName: "string",
        functionVersion: "string",
        description: "string",
        name: "string",
        routingConfig: {
            additionalVersionWeights: {
                string: 0,
            },
        },
    });
    
    type: aws:lambda:Alias
    properties:
        description: string
        functionName: string
        functionVersion: string
        name: string
        routingConfig:
            additionalVersionWeights:
                string: 0
    

    Alias Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The Alias resource accepts the following input properties:

    FunctionName string
    Lambda Function name or ARN.
    FunctionVersion string
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    Description string
    Description of the alias.
    Name string
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    RoutingConfig AliasRoutingConfig
    The Lambda alias' route configuration settings. Fields documented below
    FunctionName string
    Lambda Function name or ARN.
    FunctionVersion string
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    Description string
    Description of the alias.
    Name string
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    RoutingConfig AliasRoutingConfigArgs
    The Lambda alias' route configuration settings. Fields documented below
    functionName String
    Lambda Function name or ARN.
    functionVersion String
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    description String
    Description of the alias.
    name String
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routingConfig AliasRoutingConfig
    The Lambda alias' route configuration settings. Fields documented below
    functionName string
    Lambda Function name or ARN.
    functionVersion string
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    description string
    Description of the alias.
    name string
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routingConfig AliasRoutingConfig
    The Lambda alias' route configuration settings. Fields documented below
    function_name str
    Lambda Function name or ARN.
    function_version str
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    description str
    Description of the alias.
    name str
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routing_config lambda_.AliasRoutingConfigArgs
    The Lambda alias' route configuration settings. Fields documented below
    functionName String
    Lambda Function name or ARN.
    functionVersion String
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    description String
    Description of the alias.
    name String
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routingConfig Property Map
    The Lambda alias' route configuration settings. Fields documented below

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Alias resource produces the following output properties:

    Arn string
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    Id string
    The provider-assigned unique ID for this managed resource.
    InvokeArn string
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    Arn string
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    Id string
    The provider-assigned unique ID for this managed resource.
    InvokeArn string
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    arn String
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    id String
    The provider-assigned unique ID for this managed resource.
    invokeArn String
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    arn string
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    id string
    The provider-assigned unique ID for this managed resource.
    invokeArn string
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    arn str
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    id str
    The provider-assigned unique ID for this managed resource.
    invoke_arn str
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    arn String
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    id String
    The provider-assigned unique ID for this managed resource.
    invokeArn String
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri

    Look up Existing Alias Resource

    Get an existing Alias resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: AliasState, opts?: CustomResourceOptions): Alias
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            arn: Optional[str] = None,
            description: Optional[str] = None,
            function_name: Optional[str] = None,
            function_version: Optional[str] = None,
            invoke_arn: Optional[str] = None,
            name: Optional[str] = None,
            routing_config: Optional[_lambda_.AliasRoutingConfigArgs] = None) -> Alias
    func GetAlias(ctx *Context, name string, id IDInput, state *AliasState, opts ...ResourceOption) (*Alias, error)
    public static Alias Get(string name, Input<string> id, AliasState? state, CustomResourceOptions? opts = null)
    public static Alias get(String name, Output<String> id, AliasState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Arn string
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    Description string
    Description of the alias.
    FunctionName string
    Lambda Function name or ARN.
    FunctionVersion string
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    InvokeArn string
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    Name string
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    RoutingConfig AliasRoutingConfig
    The Lambda alias' route configuration settings. Fields documented below
    Arn string
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    Description string
    Description of the alias.
    FunctionName string
    Lambda Function name or ARN.
    FunctionVersion string
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    InvokeArn string
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    Name string
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    RoutingConfig AliasRoutingConfigArgs
    The Lambda alias' route configuration settings. Fields documented below
    arn String
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    description String
    Description of the alias.
    functionName String
    Lambda Function name or ARN.
    functionVersion String
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    invokeArn String
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    name String
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routingConfig AliasRoutingConfig
    The Lambda alias' route configuration settings. Fields documented below
    arn string
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    description string
    Description of the alias.
    functionName string
    Lambda Function name or ARN.
    functionVersion string
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    invokeArn string
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    name string
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routingConfig AliasRoutingConfig
    The Lambda alias' route configuration settings. Fields documented below
    arn str
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    description str
    Description of the alias.
    function_name str
    Lambda Function name or ARN.
    function_version str
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    invoke_arn str
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    name str
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routing_config lambda_.AliasRoutingConfigArgs
    The Lambda alias' route configuration settings. Fields documented below
    arn String
    The Amazon Resource Name (ARN) identifying your Lambda function alias.
    description String
    Description of the alias.
    functionName String
    Lambda Function name or ARN.
    functionVersion String
    Lambda function version for which you are creating the alias. Pattern: (\$LATEST|[0-9]+).
    invokeArn String
    The ARN to be used for invoking Lambda Function from API Gateway - to be used in aws.apigateway.Integration's uri
    name String
    Name for the alias you are creating. Pattern: (?!^[0-9]+$)([a-zA-Z0-9-_]+)
    routingConfig Property Map
    The Lambda alias' route configuration settings. Fields documented below

    Supporting Types

    AliasRoutingConfig, AliasRoutingConfigArgs

    AdditionalVersionWeights Dictionary<string, double>
    A map that defines the proportion of events that should be sent to different versions of a lambda function.
    AdditionalVersionWeights map[string]float64
    A map that defines the proportion of events that should be sent to different versions of a lambda function.
    additionalVersionWeights Map<String,Double>
    A map that defines the proportion of events that should be sent to different versions of a lambda function.
    additionalVersionWeights {[key: string]: number}
    A map that defines the proportion of events that should be sent to different versions of a lambda function.
    additional_version_weights Mapping[str, float]
    A map that defines the proportion of events that should be sent to different versions of a lambda function.
    additionalVersionWeights Map<Number>
    A map that defines the proportion of events that should be sent to different versions of a lambda function.

    Import

    Using pulumi import, import Lambda Function Aliases using the function_name/alias. For example:

    $ pulumi import aws:lambda/alias:Alias test_lambda_alias my_test_lambda_function/my_alias
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.45.0 published on Tuesday, Jul 16, 2024 by Pulumi