Utilizzare GetFunctionConfiguration con una CLI - AWS Lambda

Utilizzare GetFunctionConfiguration con una CLI

Gli esempi di codice seguenti mostrano come utilizzare GetFunctionConfiguration.

CLI
AWS CLI

Per recuperare le impostazioni specifiche della versione di una funzione Lambda

L'esempio get-function-configuration seguente visualizza le impostazioni per la versione 2 della funzione my-function.

aws lambda get-function-configuration \ --function-name my-function:2

Output:

{ "FunctionName": "my-function", "LastModified": "2019-09-26T20:28:40.438+0000", "RevisionId": "e52502d4-9320-4688-9cd6-152a6ab7490d", "MemorySize": 256, "Version": "2", "Role": "arn:aws:iam::123456789012:role/service-role/my-function-role-uy3l9qyq", "Timeout": 3, "Runtime": "nodejs10.x", "TracingConfig": { "Mode": "PassThrough" }, "CodeSha256": "5tT2qgzYUHaqwR716pZ2dpkn/0J1FrzJmlKidWoaCgk=", "Description": "", "VpcConfig": { "SubnetIds": [], "VpcId": "", "SecurityGroupIds": [] }, "CodeSize": 304, "FunctionArn": "arn:aws:lambda:us-west-2:123456789012:function:my-function:2", "Handler": "index.handler" }

Per ulteriori informazioni, consulta Configurazione della funzione Lambda AWS nella Guida per gli sviluppatori di AWS.

PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio recupera la configurazione specifica della versione di una funzione Lambda.

Get-LMFunctionConfiguration -FunctionName "MylambdaFunction123" -Qualifier "PowershellAlias"

Output:

CodeSha256 : uWOW0R7z+f0VyLuUg7+/D08hkMFsq0SF4seuyUZJ/R8= CodeSize : 1426 DeadLetterConfig : Amazon.Lambda.Model.DeadLetterConfig Description : Verson 3 to test Aliases Environment : Amazon.Lambda.Model.EnvironmentResponse FunctionArn : arn:aws:lambda:us-east-1:123456789012:function:MylambdaFunction123 :PowershellAlias FunctionName : MylambdaFunction123 Handler : lambda_function.launch_instance KMSKeyArn : LastModified : 2019-12-25T09:52:59.872+0000 LastUpdateStatus : Successful LastUpdateStatusReason : LastUpdateStatusReasonCode : Layers : {} MasterArn : MemorySize : 128 RevisionId : 5d7de38b-87f2-4260-8f8a-e87280e10c33 Role : arn:aws:iam::123456789012:role/service-role/lambda Runtime : python3.8 State : Active StateReason : StateReasonCode : Timeout : 600 TracingConfig : Amazon.Lambda.Model.TracingConfigResponse Version : 4 VpcConfig : Amazon.Lambda.Model.VpcConfigDetail
  • Per informazioni dettagliate sull’API, consulta GetFunctionConfiguration nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V4).

Strumenti per PowerShell V5

Esempio 1: questo esempio recupera la configurazione specifica della versione di una funzione Lambda.

Get-LMFunctionConfiguration -FunctionName "MylambdaFunction123" -Qualifier "PowershellAlias"

Output:

CodeSha256 : uWOW0R7z+f0VyLuUg7+/D08hkMFsq0SF4seuyUZJ/R8= CodeSize : 1426 DeadLetterConfig : Amazon.Lambda.Model.DeadLetterConfig Description : Verson 3 to test Aliases Environment : Amazon.Lambda.Model.EnvironmentResponse FunctionArn : arn:aws:lambda:us-east-1:123456789012:function:MylambdaFunction123 :PowershellAlias FunctionName : MylambdaFunction123 Handler : lambda_function.launch_instance KMSKeyArn : LastModified : 2019-12-25T09:52:59.872+0000 LastUpdateStatus : Successful LastUpdateStatusReason : LastUpdateStatusReasonCode : Layers : {} MasterArn : MemorySize : 128 RevisionId : 5d7de38b-87f2-4260-8f8a-e87280e10c33 Role : arn:aws:iam::123456789012:role/service-role/lambda Runtime : python3.8 State : Active StateReason : StateReasonCode : Timeout : 600 TracingConfig : Amazon.Lambda.Model.TracingConfigResponse Version : 4 VpcConfig : Amazon.Lambda.Model.VpcConfigDetail
  • Per informazioni dettagliate sull’API, consulta GetFunctionConfiguration nella documentazione di riferimento dei cmdlet di AWS Strumenti per PowerShell (V5).

Per un elenco completo delle guide per gli sviluppatori di SDK AWS ed esempi di codice, consulta la sezione Utilizzo di Lambda con un SDK AWS. Questo argomento include anche informazioni su come iniziare e dettagli sulle versioni precedenti dell'SDK.