CloudConsole

aws lambda get-function

Updated 16 November 2026 · How we write and check guides

Short answer

aws lambda get-function --function-name my-function returns the function's configuration, a short-lived download link for its code, its tags and its reserved concurrency. Use --query Configuration.Environment.Variables for environment variables, or Code.Location with curl to download the deployment package.

Terminal running aws lambda get-function --function-name my-function \ with its example output
A worked example from this page with its output. Copy commands from the text below, not from the image.

What the command does

The response has up to four parts:

  • Configuration: the same object get-function-configuration returns, including runtime, handler, role, memory, timeout, environment, VPC config, layers, State, LastUpdateStatus and LoggingConfig.
  • Code: RepositoryType and a pre-signed Location URL for zip packages (valid for a few minutes), or the image URI for container functions.
  • Tags: the function's tags.
  • Concurrency: reserved concurrency, if set.

Syntax

aws lambda get-function --function-name my-function [--qualifier live|7]

--function-name accepts a name, a full ARN, or a partial ARN. A qualified ARN or --qualifier returns that version's configuration.

Worked examples

Environment variables:

aws lambda get-function --function-name my-function \
  --query "Configuration.Environment.Variables" --output json

Download the deployed code, for example to compare it with what is in Git:

curl -s -o deployed.zip "$(aws lambda get-function --function-name my-function \
  --query Code.Location --output text)"
unzip -l deployed.zip

Is it ready, and did the last update succeed?

aws lambda get-function --function-name my-function \
  --query "Configuration.[State,StateReason,LastUpdateStatus,LastUpdateStatusReason]" --output text

Pending or InProgress means a create or update is still being applied. Failed comes with a reason such as an invalid subnet or a missing ENI permission.

Which version an alias runs, and its code hash:

aws lambda get-function --function-name my-function --qualifier live \
  --query "Configuration.[Version,CodeSha256,LastModified]" --output text

Where its logs go (custom log group, or the default /aws/lambda/my-function when not set):

aws lambda get-function --function-name my-function \
  --query "Configuration.LoggingConfig.LogGroup" --output text

Who may invoke it (a different command):

aws lambda get-policy --function-name my-function --query Policy --output text

Is the deployed code what you think it is?

When a function behaves differently from what is in your repository, compare hashes rather than guessing. Lambda reports CodeSha256 as the base64-encoded SHA-256 of the deployment package, so you can compute the same value from a locally built zip:

aws lambda get-function --function-name my-function \
  --query "Configuration.[CodeSha256,LastModified,CodeSize]" --output text
openssl dgst -sha256 -binary function.zip | base64

If the hashes differ, someone deployed a different build. LastModified tells you when, and a CloudTrail lookup for UpdateFunctionCode events on the function tells you who. Bear in mind that zip files built on different machines rarely hash the same even from identical sources, because timestamps and file order are stored inside the archive, so treat a mismatch as a prompt to look further rather than proof of a bad deploy.

Related read commands

NeedCommand
Configuration only, no code URLget-function-configuration (needs fewer permissions)
Published versionslist-versions-by-function
Aliaseslist-aliases
Poll-based triggerslist-event-source-mappings
Resource policyget-policy

Gotchas

  • Permissions differ. get-function needs lambda:GetFunction, which also exposes the code. Give read-only operators lambda:GetFunctionConfiguration if they should not download code.
  • The code URL expires quickly. Fetch it and download in the same step.
  • Secrets in environment variables are returned in plain text, decrypted, to anyone who can call this.
  • ResourceNotFoundException usually means the wrong region or a typo in the name; function names are case-sensitive.

Questions

How do I get Lambda environment variables with the CLI?

aws lambda get-function-configuration --function-name my-function --query Environment.Variables returns them as JSON.

How do I get Lambda logs from the CLI?

Logs are in CloudWatch Logs, usually /aws/lambda/<function-name>. Use aws logs tail /aws/lambda/my-function --follow, or filter-log-events to search.

How do I see which version of a Lambda function is live?

Call get-function with --qualifier set to the alias name and read Configuration.Version, or use aws lambda get-alias.

When this happens away from your desk

Checking what a function is actually configured with is often the first step when it starts failing. CloudConsole, a phone app for AWS, is built to show function settings, errors and logs on a phone.

About the app → · Download on the App Store

Sources