aws.lambda.Alias
Explore with Pulumi AI
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={
"additional_version_weights": {
"_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)
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={
"additional_version_weights": {
"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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Alias resource accepts the following input properties:
- Function
Name string - Lambda Function name or ARN.
- 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 - Lambda Function name or ARN.
- 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 - Lambda Function name or ARN.
- 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 - Lambda Function name or ARN.
- 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 - 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_.Alias Routing Config Args - The Lambda alias' route configuration settings. Fields documented below
- function
Name String - Lambda Function name or ARN.
- 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 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 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
'suri
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.
- Arn string
- The Amazon Resource Name (ARN) identifying your Lambda function alias.
- Description string
- Description of the alias.
- Function
Name string - Lambda Function name or ARN.
- 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 - Lambda Function name or ARN.
- 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 - Lambda Function name or ARN.
- 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 - Lambda Function name or ARN.
- 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 - 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
'suri
- name str
- Name for the alias you are creating. Pattern:
(?!^[0-9]+$)([a-zA-Z0-9-_]+)
- routing_
config lambda_.Alias Routing 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 - Lambda Function name or ARN.
- 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 Property Map - The Lambda alias' route configuration settings. Fields documented below
Supporting Types
AliasRoutingConfig, AliasRoutingConfigArgs
- 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 Map<String,Double>Weights - 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_ Mapping[str, float]weights - A map that defines the proportion of events that should be sent to different versions of a lambda function.
- additional
Version Map<Number>Weights - 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.