Deploying Failure Flags on AWS Lambda
On AWS Lambda, Failure Flags runs as a Lambda extension called Gremlin-Lambda, which you add to your function as a Lambda layer. The extension starts with your function and runs in the same execution environment. With Failure Flags by proxy, you don’t need to change your function’s code: the extension intercepts your function’s invocations and its outbound HTTP(S) calls, and Gremlin injects faults there. Gremlin-Lambda supports both x86_64 and arm64 functions. You can learn more about the AWS Lambda Extensions API in the AWS documentation.
How Failure Flags by proxy works on Lambda
Lambda functions can use two proxy modes:
- The Lambda Runtime API proxy sits between your function’s runtime and the Lambda Runtime API, on
localhost:5033by default. It sees every invocation and every response. The layer includes a wrapper script,/opt/bootstrap, which automatically configures your runtime to use the proxy. - The dependency proxy listens on
localhost:5034by default. Your function’s outbound HTTP and HTTPS calls reach it through the standardHTTP_PROXYandHTTPS_PROXYenvironment variables before continuing to their destination.
The ingress proxy mode used on ECS and Kubernetes isn’t used on Lambda. The Lambda Runtime API proxy covers inbound traffic.
Prerequisites
Before you begin, you'll need:
- Your Gremlin Team ID, team certificate, and team private key. You can retrieve these from Team Settings in the Gremlin web app.
- A function on a Lambda managed runtime, such as Python, Node.js, Java, .NET, or Ruby, with permission to update your function’s configuration.
Adding the Gremlin-Lambda Extension to your Lambda Function
Gremlin publishes a new layer version with each sidecar release, so the version number at the end of the ARN changes with each release. The Failure Flags sidecar release notes list the layer version for each release. If the version below is older than the latest release notes entry, use the version from the release notes.
Once you have the correct ARN, add the extension to your Lambda Function by following the instructions in the AWS Lambda Developer Guide.
Building your own Lambda Layer
You may want to build your own Lambda Layer or incorporate the gremlin-lambda binary in a Lambda container image. Maybe you're at risk of using too many layers, or maybe your organization has a package caching policy. Either way you'll want to build your own asset. You can access all of the gremlin-lambda and failure-flags-sidecar builds via our website.
Files provided via assets.gremlin.com have the following format: https://assets.gremlin.com/packages/gremlin-lambda/{VERSION}/{ARCH}/{FILE}
You can reference the LATEST release at: https://assets.gremlin.com/packages/gremlin-lambda/latest/{ARCH}/{FILE}
ARCH is one of the following:
- x86_64
- arm64
Different releases may include different files, but the current FILE set includes:
- gremlin-lambda-linux.tar.gz (x86_64)
- layer-gremlin-lambda.zip
- LICENSE
You can find a list of releases in our release notes, or in our VERSIONS file.
Enabling and configuring Failure Flags for AWS Lambda
The Gremlin-Lambda Extension accepts the following options. When a variable references a file, use a fully qualified path from the root of the function’s file system, which is typically /var/task.
You can set options using environment variables (recommended) or a configuration file. Environment variables take precedence over configuration file values. When using a configuration file,
Quick start
The following options will get you up and running quickly using the default settings:
Enabling Failure Flags
These options enable Failure Flags:
Customizing the service name and adding labels
Gremlin automatically detects the service name from your Lambda function's name and environment. If you want to override this, you can do so using the SERVICE_NAME option. You can also add metadata labels to uniquely identify your service deployments using GREMLIN_LABEL_[key], where [key] is the name of your custom label:
Adding credentials
When adding credentials, you can choose to provide your Gremlin team certificate and private key directly, in a file in your Lambda function, or as an Amazon Resource Name (ARN) resource (e.g. for storing them in Secrets Manager). You can retrieve your credentials from the Gremlin web app.
Enabling the Lambda API proxy
The Lambda Runtime API (lambda for short) proxy is specifically designed for AWS Lambda functions, as it intercepts Lambda runtime API calls.
To enable Lambda API proxy experiments, set the following options:
Enabling dependency proxy mode
The dependency proxy mode enables experiments on outbound network calls to external endpoints. For each dependency your application communicates with, Gremlin automatically creates a Failure Flag named dependency-. Gremlin also creates a generic egress Failure Flag for all dependency traffic.
To enable dependency proxy mode experiments, set the following options:
Disabling metrics
The Failure Flags sidecar can collect traffic metrics to make testing easier. This is used solely for Intelligent Health Checks, which monitor request throughput, latency, and error rate during testing to determine whether your functions pass or fail a test. Gremlin does not use these metrics for telemetry, nor does it collect sensitive details. For more information on our security practices, see our security page.
Setting common proxy options
These options apply to all proxy types:
AWS Lambda metadata discovered by Gremlin
Gremlin automatically detects the following environment variables for Lambda functions:
Using the Lambda proxy with other exec wrappers
AWS Lambda only lets a function have one exec wrapper (AWS_LAMBDA_EXEC_WRAPPER). Some other tools ship their own wrapper as a Lambda layer, such as Dynatrace (/opt/dynatrace) or OpenTelemetry (/opt/otel-handler). If your function uses one of these, you can still use the Lambda API proxy by chaining the wrappers together:
- Set
AWS_LAMBDA_EXEC_WRAPPERto/opt/bootstrap. - Set
GREMLIN_LAMBDA_NEXT_EXEC_WRAPPERto the valueAWS_LAMBDA_EXEC_WRAPPERhad before.
When the function starts, the Gremlin bootstrap script points AWS_LAMBDA_RUNTIME_API at the Lambda proxy. It then runs the next wrapper and passes along the arguments Lambda gave it. The other wrapper and your function's runtime both talk to Lambda through the proxy, so Failure Flags experiments and the other tool both keep working.
Chaining more than one wrapper
To chain several wrappers, separate their paths with :, for example /opt/dynatrace:/opt/otel-handler. They run in the order listed.
Each wrapper except the last one gets the next wrapper's path as its first argument, instead of the path to the runtime. Most wrappers don't care, because they just run whatever arguments they get (exec "$@"). Some wrappers read or change the runtime's arguments, such as wrappers that add a flag after the runtime executable. Put that kind of wrapper last in the list.
Requirements and behavior
- Every chained wrapper must exec the arguments it receives, as standard Lambda exec wrappers do.
- A chained wrapper must not overwrite
AWS_LAMBDA_RUNTIME_API. If it does, the runtime skips the Lambda proxy and Failure Flags by proxy won't trigger. - If a path in
GREMLIN_LAMBDA_NEXT_EXEC_WRAPPERis missing, is not a regular file, or is not executable, the bootstrap script skips it and logs[gremlin] skipping exec wrapper '<path>': not an executable file. The function still starts, but without that wrapper. If a path points back at/opt/bootstrap, it's skipped too.
Verifying your Failure Flags Lambda deployment
After deploying the extension, confirm that Gremlin can see your function before you try to run an experiment.
- Invoke your function at least once. Gremlin creates Failure Flags from observed activity, so nothing appears until the function runs.
- Confirm the service in Gremlin. Open Failure Flags in the web app. Your function appears under its
SERVICE_NAME, or under its auto-detectedAWS_LAMBDA_FUNCTION_NAMEif you didn't set one. - Confirm the flags. You should see the
processflag, plus flags for each proxy mode you enabled.
If the service or its flags don't appear, see Troubleshooting Failure Flags.

