Search code examples
amazon-web-servicesaws-lambda

How can I let aws cli command wait until the update finish?


I am using aws cli command to update a lambda' configuration, e.g. update memory size. The command finishes very quick but the next command which updates the same lambda failed with:

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

I see there is an update request in progress which causes the command fail. Is there a way to make my aws cli command waiting until the update finish?


Solution

  • You can use function-updated command between the two function update commands. It will wait until the Lambda's LastUpdateStatus will be successful, meaning that the next update can be invoked.

    Invoke it like so:

    aws lambda wait function-updated --function-name $MY_FUNC