Skip to content
Latchkey

aws lambda update-function-configuration: Tune a Lambda

aws lambda update-function-configuration changes a function's settings (memory, timeout, environment variables, handler, runtime, layers) without touching its code.

Code and configuration update separately. This command sets env vars and resource limits, and the main CI hazard is that it conflicts with an in-progress code update.

What it does

aws lambda update-function-configuration mutates the configuration of --function-name: memory, timeout, environment, layers, runtime, VPC, and so on. --environment fully replaces the variable map, so include every variable you want to keep.

Common usage

Terminal
aws lambda update-function-configuration \
  --function-name my-fn \
  --memory-size 512 \
  --timeout 30 \
  --environment 'Variables={STAGE=prod,LOG_LEVEL=info}'

Options

FlagWhat it does
--function-name <name>Function to update (required)
--memory-size <MB>Memory (CPU scales with it), 128-10240
--timeout <seconds>Max execution time, up to 900
--environment Variables={..}Replaces the entire env var map
--layers <arn...>Replace the layer list
--runtime / --handlerChange runtime or handler entrypoint
--revision-id <id>Optimistic-concurrency guard

In CI

--environment replaces, it does not merge, so dropping a variable silently from the map removes it in production. After update-function-code, wait for the function to leave the Pending/InProgress state (or expect ResourceConflictException) before calling this; aws lambda wait function-updated handles that.

Common errors in CI

"An error occurred (ResourceConflictException) when calling the UpdateFunctionConfiguration operation: The operation cannot be performed at this time. An update is in progress" means a prior update has not settled; use aws lambda wait function-updated. "InvalidParameterValueException: Memory size ... should be ..." flags an out-of-range memory value. "ResourceNotFoundException" is a wrong name/region. "AccessDeniedException" means missing lambda:UpdateFunctionConfiguration.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →