Skip to content

Resource: awsLambdaAlias

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

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.lambdaAlias.LambdaAlias(this, "test_lambda_alias", {
  description: "a sample description",
  functionName: "${aws_lambda_function.lambda_function_test.arn}",
  functionVersion: "1",
  name: "my_alias",
  routingConfig: {
    additionalVersionWeights: {
      2: 0.5,
    },
  },
});

Argument Reference

  • name - (Required) Name for the alias you are creating. Pattern: (?!^[09]+$)([aZAZ09_]+)
  • description - (Optional) Description of the alias.
  • functionName - (Required) Lambda Function name or ARN.
  • functionVersion - (Required) Lambda function version for which you are creating the alias. Pattern: (\$latest|[09]+).
  • routingConfig - (Optional) The Lambda alias' route configuration settings. Fields documented below

For routing_config the following attributes are supported:

  • additionalVersionWeights - (Optional) A map that defines the proportion of events that should be sent to different versions of a lambda function.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The Amazon Resource Name (ARN) identifying your Lambda function alias.
  • invokeArn - The ARN to be used for invoking Lambda Function from API Gateway - to be used in awsApiGatewayIntegration's uri

Import

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

$ terraform import aws_lambda_alias.test_lambda_alias my_test_lambda_function/my_alias