ResourceConflictException: The operation cannot be performed at this time. An update is in progress
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-codeand then immediatelyupdate-function-configuration(for example to change environment variables). publish-versionstraight afterupdate-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.

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.
Did it start after a deploy? What changed? on the app’s alarm screen lists the deploys and configuration changes from the hour before the alarm fired.
About the app → · Download on the App Store