Use CreateAlias
with a CLI
The following code examples show how to use CreateAlias
.
- CLI
-
- AWS CLI
-
To create an alias for a Lambda function
The following
create-alias
example creates an alias namedLIVE
that points to version 1 of themy-function
Lambda function.aws lambda create-alias \ --function-name
my-function
\ --description"alias for live version of function"
\ --function-version1
\ --nameLIVE
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 AWS Lambda Function Aliases in the AWS Lambda Developer Guide.
-
For API details, see CreateAlias
in AWS 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 AWS Tools for PowerShell Cmdlet Reference.
-
For a complete list of AWS SDK developer guides and code examples, see Using Lambda with an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.