Skip to main content

Lambda update function memory

Lambda update function memory causes the memory of a Lambda function to be updated to a specified value for a certain duration.

  • It checks the performance of the application (or service) running with a new memory limit.
  • It helps determine a safe overall memory limit value for the function.
  • Smaller the memory limit higher will be the time taken by the Lambda function under load.

Lambda Update Function Memory


View fault usage
Hitting a memory limit with Lambda functions may slow down the service and impact their delivery. Running out of memory due to smaller limits may interrupt the flow of the given function. These fault helps build resilience to such unexpected scenarios.


  • Kubernetes >= 1.17
  • Access for operating AWS Lambda functions.
  • Kubernetes secret that has AWS access configuration(key) in the CHAOS_NAMESPACE. A secret file looks like this:
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
  • It is recommended to use the same secret name, i.e. cloud-secret. Otherwise, you will need to update the AWS_SHARED_CREDENTIALS_FILE environment variable in the fault template and you may be unable to use the default health check probes.

  • Refer to AWS Named Profile For Chaos to know how to use a different profile for AWS faults.

Permissions required

Here is an example AWS policy to execute the fault.

View policy for the fault
"Version": "2012-10-17",
"Statement": [
"Effect": "Allow",
"Action": [
"Resource": "*"

Refer to the superset permission/policy to execute all AWS faults.

Default validations

The Lambda function should be up and running.

Fault tunables

Fault tunables

Mandatory fields

Variables Description Notes
FUNCTION_NAME Function name of the target lambda function. It supports single function name. For example, test-function
MEMORY_IN_MEGABYTES Provide the value of the memory limit of a function in megabytes. The minimum value of the memory limit on a lambda function is 128Mb and the maximum upto 10240Mb
REGION The region name of the target lambda function For example, us-east-2

Optional fields

Variables Description Notes
TOTAL_CHAOS_DURATION The total time duration for chaos insertion in seconds Defaults to 30s
CHAOS_INTERVAL The interval (in seconds) between successive instance termination. Defaults to 30s
SEQUENCE It defines sequence of chaos execution for multiple instance Default value: parallel. Supported: serial, parallel
RAMP_TIME Period to wait before and after injection of chaos in seconds For example, 30

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

It can update the Lambda function memory limit to a newer value by using MEMORY_IN_MEGABYTES environment variable as shown below.

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'