文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
ListVersionsByFunction
搭配 CLI 使用
下列程式碼範例示範如何使用 ListVersionsByFunction
。
- CLI
-
- AWS CLI
-
若要擷取函數的版本清單
下列
list-versions-by-function
範例顯示my-function
Lambda 函數的版本清單。aws lambda list-versions-by-function \ --function-name
my-function
輸出:
{ "Versions": [ { "TracingConfig": { "Mode": "PassThrough" }, "Version": "$LATEST", "CodeSha256": "sU0cJ2/hOZevwV/lTxCuQqK3gDZP3i8gUoqUUVRmY6E=", "FunctionName": "my-function", "VpcConfig": { "SubnetIds": [], "VpcId": "", "SecurityGroupIds": [] }, "MemorySize": 256, "RevisionId": "93017fc9-59cb-41dc-901b-4845ce4bf668", "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": "949c8914-012e-4795-998c-e467121951b1", "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": "cd669f21-0f3d-4e1c-9566-948837f2e2ea", "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" } ] }
如需詳細資訊,請參閱 AWS Lambda 開發人員指南中的設定 Lambda 函數別名。 AWS
-
如需 API 詳細資訊,請參閱 AWS CLI 命令參考中的 ListVersionsByFunction
。
-
- PowerShell
-
- for PowerShell 工具
-
範例 1:此範例會傳回 Lambda 函數每個版本的特定版本組態清單。
Get-LMVersionsByFunction -FunctionName "MylambdaFunction123"
輸出:
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
-
如需 API 詳細資訊,請參閱 AWS Tools for PowerShell Cmdlet 參考中的 ListVersionsByFunction。
-
ListTags
PublishVersion