# ResourceConflictException: The operation cannot be performed at this time. An update is in progress

AWS error fixes · Updated 16 November 2026

**Short answer:** Lambda is still applying a previous change to the function, and it accepts only one update at a time. Wait for LastUpdateStatus to become Successful, for example with aws lambda wait function-updated, before sending the next code, configuration or publish call. It shows up mostly in deploy scripts that update code and configuration back to back.

## Why it happens

```
An error occurred (ResourceConflictException) when calling the UpdateFunctionConfiguration operation:
The operation cannot be performed at this time. An update is in progress for resource:
arn:aws:lambda:eu-west-2:123456789012:function:my-function
```

Code and configuration updates are asynchronous. The API call returns quickly, but the function's `LastUpdateStatus` stays `InProgress` while Lambda prepares the new code or settings, which can take longer for functions in a VPC or with container images. Any other update sent during that window is rejected with this error.

```
aws lambda get-function-configuration --function-name my-function \
  --query '[State,LastUpdateStatus,LastUpdateStatusReason]'
```

## Typical triggers

- A deploy script runs `update-function-code` and then immediately `update-function-configuration` (for example to change environment variables).
- `publish-version` straight after `update-function-code`.
- Two pipelines, or two Terraform runs, deploying the same function at once.
- A previous update failed and is being rolled back, so the status stays busy longer than usual.
- Someone edits environment variables in the console while a pipeline is deploying. Manual changes and automated deploys to the same function should not overlap; the loser of the race gets this error, and the winner's settings may be overwritten by the next run anyway.

## Fix your deploy script

Insert a waiter after each update. It polls until the update completes, and fails if it ends in `Failed`:

```
aws lambda update-function-code --function-name my-function \
  --s3-bucket my-artifacts-bucket --s3-key my-function/v42.zip
aws lambda wait function-updated --function-name my-function

aws lambda update-function-configuration --function-name my-function \
  --environment 'Variables={LOG_LEVEL=info,FEATURE_X=on}'
aws lambda wait function-updated --function-name my-function

aws lambda publish-version --function-name my-function --description v42
```

Alternatively, apply code and version in one call with `update-function-code --publish`, which removes one of the races.

In SDK code, the same waiters exist (`function_updated` in boto3, `waitUntilFunctionUpdated` in JavaScript v3). Infrastructure tools such as Terraform and CloudFormation already wait internally; if you still see this error from them, something else is updating the function at the same time.

## If the update failed

When `LastUpdateStatus` is `Failed`, the waiter exits with an error. `LastUpdateStatusReason` explains why, for example a subnet with no free IP addresses, a missing ECR image, or a KMS key the service can't use. Fix that cause and run the update again; the function keeps serving the last successful code in the meantime.

## Other ResourceConflictException messages

| Message | Meaning |
|---|---|
| `Function already exist: my-function` | `create-function` for a name that exists; use `update-function-code` |
| `The statement id (AllowS3) provided already exists` | `add-permission` with a duplicate `--statement-id`; choose a new ID or remove the old one first |
| Mentions the function is currently in the `Pending` state | A newly created function isn't `Active` yet; wait with `aws lambda wait function-active-v2` |

Avoid "fixing" this with a fixed `sleep 10`. Update times vary, so a sleep that works today flakes tomorrow; the waiter is exact.

## Questions

### How long does a Lambda function update take?

Usually seconds, but it varies with package type, size and VPC configuration. Poll LastUpdateStatus or use aws lambda wait function-updated rather than assuming a fixed time.

### Can I update Lambda code and configuration at the same time?

Not in parallel. Send one update, wait for it to finish, then send the next.

### Why does Terraform get ResourceConflictException on Lambda?

Another process, often a CI job or a second Terraform run, is updating the same function at the same time. Serialise deployments to each function.

## When this happens away from your desk

This error breaks deploys rather than traffic: the old version keeps serving. CloudConsole, a phone app for AWS, is built to show function alarms on your phone, which helps confirm production is healthy while a stuck pipeline is retried.

[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

- [Lambda function states](https://docs.aws.amazon.com/lambda/latest/dg/functions-states.html)
- [AWS Lambda documentation](https://docs.aws.amazon.com/lambda/)

## Related

- [aws lambda update-function-code](https://cloudconsole.dev/cli/lambda-update-function-code)
- [aws lambda update-function-configuration](https://cloudconsole.dev/cli/lambda-update-function-configuration)
- [aws lambda publish-version](https://cloudconsole.dev/cli/lambda-publish-version)
- [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)
- [CodeStorageExceededException: Code storage limit exceeded](https://cloudconsole.dev/errors/lambda-codestorageexceeded)

---

Source: https://cloudconsole.dev/errors/lambda-resourceconflictexception

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