# aws lambda get-function

AWS CLI commands · Updated 16 November 2026

**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.

## 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

| Need | Command |
|---|---|
| Configuration only, no code URL | `get-function-configuration` (needs fewer permissions) |
| Published versions | `list-versions-by-function` |
| Aliases | `list-aliases` |
| Poll-based triggers | `list-event-source-mappings` |
| Resource policy | `get-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 CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [AWS CLI Command Reference: lambda get-function](https://docs.aws.amazon.com/cli/latest/reference/lambda/get-function.html)
- [AWS Lambda Developer Guide](https://docs.aws.amazon.com/lambda/latest/dg/welcome.html)

## Related

- [aws lambda list-functions](https://cloudconsole.dev/cli/lambda-list-functions)
- [aws lambda update-function-configuration](https://cloudconsole.dev/cli/lambda-update-function-configuration)
- [aws lambda list-versions-by-function](https://cloudconsole.dev/cli/lambda-list-versions-by-function)
- [aws logs tail](https://cloudconsole.dev/cli/logs-tail)
- [How to update Lambda environment variables](https://cloudconsole.dev/how-to/update-lambda-environment-variables)
- [aws lambda add-permission](https://cloudconsole.dev/cli/lambda-add-permission)

---

Source: https://cloudconsole.dev/cli/lambda-get-function

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
