Skip to main content

Lambda update function memory

Lambda update function memory is an AWS fault that:

  • Updates the memory of a Lambda function to a specific value during a chaos duration.
  • Checks the performance of the application (or service) running with a new memory limit thereby determining a safe overall memory limit value for the function. The Lambda function takes longer to execute if the memory limit is reduced.
Fault execution flow chart

Lambda Update Function Memory


View fault usage
Hitting a memory limit is a common scenario with Lambda functions that slows down the service and impacts their delivery. Such scenarios occur despite the availability aids provided by AWS or determined by users.

Running out of memory due to a small limit interrupts the flow of the given function. This chaos fault helps the application build immunity against such scenarios.


  • Kubernetes >= 1.17
  • Kubernetes secret that has AWS access configuration (key) in the CHAOS_NAMESPACE. Below is a sample secret file:
apiVersion: v1
kind: Secret
name: cloud-secret
type: Opaque
cloud_config.yml: |-
# Add the cloud AWS credentials respectively
aws_access_key_id = XXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXX
  • If you change the secret key name (from cloud_config.yml), ensure that you update the AWS_SHARED_CREDENTIALS_FILE environment variable value on experiment.yaml with the same name.

Permissions required

  • Here is an example AWS policy to execute the Lambda update function memory fault.
View policy for this fault
"Version": "2012-10-17",
"Statement": [
"Effect": "Allow",
"Action": [
"Resource": "*"

Default validation

  • The Lambda function should be up and running.

Chaos injection validation

  • You can validate the Lambda update function memory fault from the general configuration section of the target Lambda function in the AWS console. While inecting chaos, the function memory is updated with the value you provide.

Experiment tunables

Fault tunables

Mandatory Fields

Variables Description Notes
FUNCTION_NAME Name of the target Lambda function. It supports a single function name. For example, test-function.
MEMORY_IN_MEGABYTES Memory limit of a function (in MB). Memory range of the Lambda function is 128 MB to 10240 MB.
REGION Region name of the target Lambda function. For example, us-east-2.

Optional Fields

Variables Description Notes
TOTAL_CHAOS_DURATION Duration to insert chaos (in seconds). Defaults to 30s.
CHAOS_INTERVAL Time interval between two successive instance terminations (in seconds). Defaults to 30s.
SEQUENCE Sequence of chaos execution for multiple instances. Defaults to parallel. Supports serial sequence as well.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30s.

Fault examples

Common and AWS specific tunables

Refer to the common attributes and AWS specific tunables to tune the common tunables for all faults and AWS specific tunables.

Memory limit

You can update the value of the Lambda function memory limit using the MEMORY_IN_MEGABYTES environment variable.

Use the following example to tune it:

# contains the memory limit value for the lambda function
kind: ChaosEngine
name: engine-nginx
engineState: "active"
chaosServiceAccount: litmus-admin
- name: lambda-update-function-memory
# provide the function memory limit
value: '10'
# provide the function name for memory limit chaos
value: 'chaos-function'