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);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:
- Function
Name string The function ARN of the Lambda function for which you want to create an alias.
- Function
Version 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-_]+)- Routing
Config AliasRouting Config Args The Lambda alias’ route configuration settings. Fields documented below
- Function
Name string The function ARN of the Lambda function for which you want to create an alias.
- Function
Version 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-_]+)- Routing
Config AliasRouting Config The Lambda alias’ route configuration settings. Fields documented below
- function
Name string The function ARN of the Lambda function for which you want to create an alias.
- function
Version 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-_]+)- routing
Config AliasRouting Config 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[AliasRouting Config] 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:
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): Aliasstatic 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.
- Function
Name string The function ARN of the Lambda function for which you want to create an alias.
- Function
Version string Lambda function version for which you are creating the alias. Pattern:
(\$LATEST|[0-9]+).- Invoke
Arn string The ARN to be used for invoking Lambda Function from API Gateway - to be used in
aws.apigateway.Integration’suri- Name string
Name for the alias you are creating. Pattern:
(?!^[0-9]+$)([a-zA-Z0-9-_]+)- Routing
Config AliasRouting Config Args 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.
- Function
Name string The function ARN of the Lambda function for which you want to create an alias.
- Function
Version string Lambda function version for which you are creating the alias. Pattern:
(\$LATEST|[0-9]+).- Invoke
Arn string The ARN to be used for invoking Lambda Function from API Gateway - to be used in
aws.apigateway.Integration’suri- Name string
Name for the alias you are creating. Pattern:
(?!^[0-9]+$)([a-zA-Z0-9-_]+)- Routing
Config AliasRouting Config 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.
- function
Name string The function ARN of the Lambda function for which you want to create an alias.
- function
Version string Lambda function version for which you are creating the alias. Pattern:
(\$LATEST|[0-9]+).- invoke
Arn string The ARN to be used for invoking Lambda Function from API Gateway - to be used in
aws.apigateway.Integration’suri- name string
Name for the alias you are creating. Pattern:
(?!^[0-9]+$)([a-zA-Z0-9-_]+)- routing
Config AliasRouting Config 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’suri- name str
Name for the alias you are creating. Pattern:
(?!^[0-9]+$)([a-zA-Z0-9-_]+)- routing_
config Dict[AliasRouting Config] The Lambda alias’ route configuration settings. Fields documented below
Supporting Types
AliasRoutingConfig
- Additional
Version Dictionary<string, double>Weights A map that defines the proportion of events that should be sent to different versions of a lambda function.
- Additional
Version map[string]float64Weights A map that defines the proportion of events that should be sent to different versions of a lambda function.
- additional
Version {[key: string]: number}Weights A map that defines the proportion of events that should be sent to different versions of a lambda function.
- additional
Version Dict[str, Number]Weights 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
awsTerraform Provider.