aws logo
AWS Classic v5.33.0, Mar 24 23

aws.lambda.Alias

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

using System.Collections.Generic;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var testLambdaAlias = new Aws.Lambda.Alias("testLambdaAlias", new()
    {
        Description = "a sample description",
        FunctionName = aws_lambda_function.Lambda_function_test.Arn,
        FunctionVersion = "1",
        RoutingConfig = new Aws.Lambda.Inputs.AliasRoutingConfigArgs
        {
            AdditionalVersionWeights = 
            {
                { "2", 0.5 },
            },
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := lambda.NewAlias(ctx, "testLambdaAlias", &lambda.AliasArgs{
			Description:     pulumi.String("a sample description"),
			FunctionName:    pulumi.Any(aws_lambda_function.Lambda_function_test.Arn),
			FunctionVersion: pulumi.String("1"),
			RoutingConfig: &lambda.AliasRoutingConfigArgs{
				AdditionalVersionWeights: pulumi.Float64Map{
					"2": pulumi.Float64(0.5),
				},
			},
		})
		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.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()        
            .description("a sample description")
            .functionName(aws_lambda_function.lambda_function_test().arn())
            .functionVersion("1")
            .routingConfig(AliasRoutingConfigArgs.builder()
                .additionalVersionWeights(Map.of("2", 0.5))
                .build())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

test_lambda_alias = aws.lambda_.Alias("testLambdaAlias",
    description="a sample description",
    function_name=aws_lambda_function["lambda_function_test"]["arn"],
    function_version="1",
    routing_config=aws.lambda_.AliasRoutingConfigArgs(
        additional_version_weights={
            "2": 0.5,
        },
    ))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testLambdaAlias = new aws.lambda.Alias("testLambdaAlias", {
    description: "a sample description",
    functionName: aws_lambda_function.lambda_function_test.arn,
    functionVersion: "1",
    routingConfig: {
        additionalVersionWeights: {
            "2": 0.5,
        },
    },
});
resources:
  testLambdaAlias:
    type: aws:lambda:Alias
    properties:
      description: a sample description
      functionName: ${aws_lambda_function.lambda_function_test.arn}
      functionVersion: '1'
      routingConfig:
        additionalVersionWeights:
          '2': 0.5

Create Alias Resource

new Alias(name: string, args: AliasArgs, opts?: CustomResourceOptions);
@overload
def Alias(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          description: Optional[str] = None,
          function_name: Optional[str] = None,
          function_version: Optional[str] = None,
          name: Optional[str] = None,
          routing_config: Optional[_lambda_.AliasRoutingConfigArgs] = None)
@overload
def Alias(resource_name: str,
          args: AliasArgs,
          opts: Optional[ResourceOptions] = 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.

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.

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 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 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 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 AliasRoutingConfigArgs

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 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 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 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 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 AliasRoutingConfigArgs

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 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

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

Lambda Function Aliases can be imported using the function_name/alias, e.g.,

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

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.