View a markdown version of this page

Utilizzare ListVersionsByFunction con una CLI - AWS Lambda

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Utilizzare ListVersionsByFunction con una CLI

I seguenti esempi di codice mostrano come usare ListVersionsByFunction.

CLI
AWS CLI

Per recuperare un elenco di versioni di una funzione

L’esempio list-versions-by-function seguente visualizza l’elenco di versioni per la funzione Lambda my-function.

aws lambda list-versions-by-function \ --function-name my-function

Output:

{ "Versions": [ { "TracingConfig": { "Mode": "PassThrough" }, "Version": "$LATEST", "CodeSha256": "sU0cJ2/hOZevwV/lTxCuQqK3gDZP3i8gUoqUUVRmY6E=", "FunctionName": "my-function", "VpcConfig": { "SubnetIds": [], "VpcId": "", "SecurityGroupIds": [] }, "MemorySize": 256, "RevisionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE11111", "CodeSize": 266, "FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function:$LATEST", "Handler": "index.handler", "Role": "arn:aws:iam::123456789012:role/service-role/helloWorldPython-role-uy3l9qyq", "Timeout": 3, "LastModified": "2019-10-01T16:47:28.490+0000", "Runtime": "nodejs10.x", "Description": "" }, { "TracingConfig": { "Mode": "PassThrough" }, "Version": "1", "CodeSha256": "5tT2qgzYUHoqwR616pZ2dpkn/0J1FrzJmlKidWaaCgk=", "FunctionName": "my-function", "VpcConfig": { "SubnetIds": [], "VpcId": "", "SecurityGroupIds": [] }, "MemorySize": 256, "RevisionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE22222", "CodeSize": 304, "FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function:1", "Handler": "index.handler", "Role": "arn:aws:iam::123456789012:role/service-role/helloWorldPython-role-uy3l9qyq", "Timeout": 3, "LastModified": "2019-09-26T20:28:40.438+0000", "Runtime": "nodejs10.x", "Description": "new version" }, { "TracingConfig": { "Mode": "PassThrough" }, "Version": "2", "CodeSha256": "sU0cJ2/hOZevwV/lTxCuQqK3gDZP3i8gUoqUUVRmY6E=", "FunctionName": "my-function", "VpcConfig": { "SubnetIds": [], "VpcId": "", "SecurityGroupIds": [] }, "MemorySize": 256, "RevisionId": "a1b2c3d4-5678-90ab-cdef-EXAMPLE33333", "CodeSize": 266, "FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function:2", "Handler": "index.handler", "Role": "arn:aws:iam::123456789012:role/service-role/helloWorldPython-role-uy3l9qyq", "Timeout": 3, "LastModified": "2019-10-01T16:47:28.490+0000", "Runtime": "nodejs10.x", "Description": "newer version" } ] }

Per ulteriori informazioni, vedere Configurazione AWS Alias delle funzioni Lambda nel AWS Guida per sviluppatori Lambda.

PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio restituisce l’elenco di configurazioni specifiche della versione per ogni versione della funzione Lambda.

Get-LMVersionsByFunction -FunctionName "MylambdaFunction123"

Output:

FunctionName Runtime MemorySize Timeout CodeSize LastModified RoleName ------------ ------- ---------- ------- -------- ------------ -------- MylambdaFunction123 python3.8 128 600 659 2020-01-10T03:20:56.390+0000 lambda MylambdaFunction123 python3.8 128 5 1426 2019-12-25T09:19:02.238+0000 lambda MylambdaFunction123 python3.8 128 5 1426 2019-12-25T09:39:36.779+0000 lambda MylambdaFunction123 python3.8 128 600 1426 2019-12-25T09:52:59.872+0000 lambda
  • Per i dettagli sull'API, vedi ListVersionsByFunction nel AWS Strumenti per PowerShell Riferimento al cmdlet (V4).

Strumenti per PowerShell V5

Esempio 1: questo esempio restituisce l’elenco di configurazioni specifiche della versione per ogni versione della funzione Lambda.

Get-LMVersionsByFunction -FunctionName "MylambdaFunction123"

Output:

FunctionName Runtime MemorySize Timeout CodeSize LastModified RoleName ------------ ------- ---------- ------- -------- ------------ -------- MylambdaFunction123 python3.8 128 600 659 2020-01-10T03:20:56.390+0000 lambda MylambdaFunction123 python3.8 128 5 1426 2019-12-25T09:19:02.238+0000 lambda MylambdaFunction123 python3.8 128 5 1426 2019-12-25T09:39:36.779+0000 lambda MylambdaFunction123 python3.8 128 600 1426 2019-12-25T09:52:59.872+0000 lambda
  • Per i dettagli sull'API, vedi ListVersionsByFunction nel AWS Strumenti per PowerShell Riferimento al cmdlet (V5).

Per un elenco completo di AWS Guide per sviluppatori SDK ed esempi di codice, consulta Usare Lambda con un AWS SDK. Questo argomento include anche informazioni su come iniziare e dettagli sulle versioni precedenti dell’SDK.