Use CreateAlias with an Amazon SDK or CLI - Amazon Lambda
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use CreateAlias with an Amazon SDK or CLI

The following code examples show how to use CreateAlias.

CLI
Amazon CLI

To create an alias for a Lambda function

The following create-alias example creates an alias named LIVE that points to version 1 of the my-function Lambda function.

aws lambda create-alias \ --function-name my-function \ --description "alias for live version of function" \ --function-version 1 \ --name LIVE

Output:

{ "FunctionVersion": "1", "Name": "LIVE", "AliasArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function:LIVE", "RevisionId": "873282ed-4cd3-4dc8-a069-d0c647e470c6", "Description": "alias for live version of function" }

For more information, see Configuring Amazon Lambda Function Aliases in the Amazon Lambda Developer Guide.

  • For API details, see CreateAlias in Amazon CLI Command Reference.

PowerShell
Tools for PowerShell

Example 1: This example creates a New Lambda Alias for specified version and routing configuration to specify the percentage of invocation requests that it receives.

New-LMAlias -FunctionName "MylambdaFunction123" -RoutingConfig_AdditionalVersionWeight @{Name="1";Value="0.6} -Description "Alias for version 4" -FunctionVersion 4 -Name "PowershellAlias"
  • For API details, see CreateAlias in Amazon Tools for PowerShell Cmdlet Reference.

For a complete list of Amazon SDK developer guides and code examples, see Using Lambda with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.