# IAM policy example: deploy code to one Lambda function, with a least privilege rewrite

Facts read 16 Nov 2026. Page reviewed 16 Nov 2026.

Allows a deployment role to upload new code, change the configuration and publish a version of one function. It cannot create functions or change who may invoke them. The original allows the Update wildcard on every function in a Region.

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Deploy",
      "Effect": "Allow",
      "Action": [
        "lambda:Update*",
        "lambda:PublishVersion",
        "lambda:GetFunction"
      ],
      "Resource": "arn:aws:lambda:us-east-1:111122223333:function:*"
    }
  ]
}
```

## What it allows

- Allows update actions, version publishing and function reads on every function in one Region.

- Allows 15 actions (lambda:Update*, lambda:PublishVersion, lambda:GetFunction) on arn:aws:lambda:us-east-1:111122223333:function:*.

Checks:
- No flags.

The Update wildcard covers 13 actions and the resource covers every function, so the role can alter any function in the account.

## Least privilege rewrite

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "DeployOne",
      "Effect": "Allow",
      "Action": [
        "lambda:UpdateFunctionCode",
        "lambda:UpdateFunctionConfiguration",
        "lambda:PublishVersion",
        "lambda:GetFunction"
      ],
      "Resource": "arn:aws:lambda:us-east-1:111122223333:function:my-function"
    }
  ]
}
```

The rewrite names four actions and one function ARN. Updates to aliases, event source mappings and function URL settings are removed.

- Allows 4 actions (lambda:UpdateFunctionCode, lambda:UpdateFunctionConfiguration, lambda:PublishVersion, lambda:GetFunction) on arn:aws:lambda:us-east-1:111122223333:function:my-function.

Checks:
- No flags.

- [Paste it into the workbench](/)
- [Every Lambda action and its access level](/actions/lambda/)

## Related pages

- [IAM policy example: let a Lambda function write logs](/examples/lambda-execution-role-write-logs/)
- [IAM policy example: let Lambda poll one SQS queue](/examples/lambda-sqs-event-source-permissions/)
- [IAM policy example: read one DynamoDB table](/examples/dynamodb-read-one-table/)
- [All of them](/examples/)

## Sources

- AWS Lambda Developer Guide: permissions: https://docs.aws.amazon.com/lambda/latest/dg/lambda-permissions.html (read 16 Nov 2026)
- AWS Service Authorization Reference, programmatic access (fetched 16 Nov 2026): https://docs.aws.amazon.com/service-authorization/latest/reference/service-reference.html (read 16 Nov 2026)

Last reviewed 16 Nov 2026. Canonical: https://iampolicygenerator.com/examples/lambda-deploy-one-function/

This site is not affiliated with Amazon Web Services. AWS service and product names are used only to describe AWS services.
