Skip to content
Software capabilities
AWS Lambda

List versions of an AWS Lambda function

Use the AWS CLI to inspect the versions of a function from your terminal. The Go SDK’s paginator lets a script process each page of version configurations.

Documentation reviewed · 2 methods with sources

Ways to do it

  1. CLI: aws lambda list-versions-by-function
  2. SDK: lambda.NewListVersionsByFunctionPaginator
CLI

aws lambda list-versions-by-function

Pass the function name or ARN to retrieve version numbers and their associated configuration.

Read source: AWS CLI list-versions-by-function
Requirements
AWS CLI credentials with lambda:ListVersionsByFunction and the function’s name or ARN and Region.
Limitations
With --no-paginate, the CLI makes only one service call. Lambda returns up to 50 versions per call.

Example shell

aws lambda list-versions-by-function --function-name "$FUNCTION_NAME" --query 'Versions[].Version'
SDK

lambda.NewListVersionsByFunctionPaginator

Initialize the paginator with ListVersionsByFunctionInput and call NextPage while HasMorePages reports more results.

Read source: AWS SDK for Go v2 ListVersionsByFunction
Requirements
An AWS SDK for Go v2 Lambda client with regional credentials, lambda:ListVersionsByFunction permission, and FunctionName set.
Limitations
A single ListVersionsByFunction call returns up to 50 items even when you request a larger MaxItems value.