There are more AWS SDK examples available in the AWS Doc SDK Examples
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-aliasexample creates an alias namedLIVEthat points to version 1 of themy-functionLambda function.aws lambda create-alias \ --function-namemy-function\ --description"alias for live version of function"\ --function-version1\ --nameLIVEOutput:
{ "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 V4
-
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 (V4).
-
- Tools for PowerShell V5
-
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 (V5).
-