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 Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var testLambdaAlias = new Aws.Lambda.Alias("testLambdaAlias", new Aws.Lambda.AliasArgs
        {
            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/v2/go/aws/lambda"
    "github.com/pulumi/pulumi/sdk/v2/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.String(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
    })
}
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={
        "additionalVersionWeights": {
            "2": 0.5,
        },
    })
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const testLambdaAlias = new aws.lambda.Alias("test_lambda_alias", {
    description: "a sample description",
    functionName: aws_lambda_function_lambda_function_test.arn,
    functionVersion: "1",
    routingConfig: {
        additionalVersionWeights: {
            "2": 0.5,
        },
    },
});

Create a Alias Resource

new Alias(name: string, args: AliasArgs, opts?: CustomResourceOptions);
def Alias(resource_name, opts=None, description=None, function_name=None, function_version=None, name=None, routing_config=None, __props__=None);
func NewAlias(ctx *Context, name string, args AliasArgs, opts ...ResourceOption) (*Alias, error)
public Alias(string name, AliasArgs args, CustomResourceOptions? opts = null)
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.
opts ResourceOptions
A bag of options that control this 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.

Alias Resource Properties

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

Inputs

The Alias resource accepts the following input properties:

FunctionName string

The function ARN of the Lambda function for which you want to create an alias.

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

The function ARN of the Lambda function for which you want to create an alias.

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

The function ARN of the Lambda function for which you want to create an alias.

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

The function ARN of the Lambda function for which you want to create an alias.

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 Dict[AliasRoutingConfig]

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

Look up an 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
static get(resource_name, id, opts=None, arn=None, description=None, function_name=None, function_version=None, invoke_arn=None, name=None, routing_config=None, __props__=None);
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)
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.

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

The function ARN of the Lambda function for which you want to create an alias.

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

The function ARN of the Lambda function for which you want to create an alias.

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

The function ARN of the Lambda function for which you want to create an alias.

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

The function ARN of the Lambda function for which you want to create an alias.

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 Dict[AliasRoutingConfig]

The Lambda alias’ route configuration settings. Fields documented below

Supporting Types

AliasRoutingConfig

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

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 {[key: string]: number}

A map that defines the proportion of events that should be sent to different versions of a lambda function.

additionalVersionWeights Dict[str, Number]

A map that defines the proportion of events that should be sent to different versions of a lambda function.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.