• Stars
    star
    287
  • Rank 140,391 (Top 3 %)
  • Language
    JavaScript
  • License
    Mozilla Public Li...
  • Created over 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Serverless chaos monkey for AWS (runs on AWS Lambda) โ˜๏ธ ๐Ÿ’ฅ
      _                       _                 _         _
  ___| |__   __ _  ___  ___  | | __ _ _ __ ___ | |__   __| | __ _
 / __| '_ \ / _` |/ _ \/ __| | |/ _` | '_ ` _ \| '_ \ / _` |/ _` |
| (__| | | | (_| | (_) \__ \ | | (_| | | | | | | |_) | (_| | (_| |
 \___|_| |_|\__,_|\___/|___/ |_|\__,_|_| |_| |_|_.__/ \__,_|\__,_|

Meet Chaos Lambda

Chaos Lambda is a serverless implementation of Netflix's Chaos Monkey.

It will wreak havoc* on your AWS infrastructure to help you build systems that are lean, mean, and resilient to failure.

* - in an extremely controlled manner - Chaos Lambda is disabled by default

About

Chaos Lambda is a small tool for testing resiliency and recoverability of AWS-based architectures. Once configured and deployed, it will randomly terminate or otherwise interfere* with the operation of your EC2 instances and ECS tasks. It is inspired by Netflix's Chaos Monkey, but instead of requiring an EC2 instance to run on, it uses AWS Lambda. Think of it as Chaos Monkey rebuilt with modern tech.

Installation

You need Node.js to use Chaos Lambda (we will rewrite the CLI in Golang ats some point):

# npm comes bundled with Node.js
npm install -g chaos-lambda

Setting Up

AWS Configuration

An IAM user and a role for the lambda need to be set up first.

IAM User

Must be set up and credentials set up in ~/.aws/credentials

Lambda Role

Required policies:

  • AmazonEC2FullAccess

Setting up Chaos Lambda

To create the AWS Lambda function run:

chaos-lambda deploy -r $lambda-role-arn

This will create a state file (chaos_lambda_config.json) which is needed for subsequent re-deploys, and deploy Chaos Lambda to AWS. It will be configured to run once an hour, but it won't do anything every time it runs.

To configure termination rules, run deploy with a Chaosfile:

chaos-lambda deploy -c Chaosfile.json

Chaosfile.json

Example Chaosfile.json:

{
  "interval": "60",
  "enableForASGs": [
  ],
  "disableForASGs": [
  ]
}

Options:

  • interval (in minutes) - how frequently Chaos Lambda should run. Minimum value is 5. Default value is 60.
  • enableForASGs - whitelist of names of ASGs to pick an instance from. Instances in other ASGs will be left alone. Empty list ([]) means Chaos Lambda won't do anything.
  • disableForASGs - names of ASGs that should not be touched; instances in any other ASG are eligible for termination.

If both enableForASGs and disableForASGs are specified, then only enableForASGs rules are applied.

Enable/Disable/Status: Once deployed you can enable and disable Chaos Lambda without redeploying.

  • chaos-lambda disable - Will disable Chaos Lambda
  • chaos-lambda enable - Will enable Chaos Lambda
  • chaos-lambda status - Will display current status

Chaos Lambda vs Chaos Monkey

Chaos Lambda is inspired by Netflixโ€™s Chaos Monkey. Curious about the differences? Hereโ€™s a handy summary:

Lambda Monkey
Serverless (runs on AWS Lambda) - no maintenance Needs EC2 instances to run on
Extremely easy to deploy Needs quite a bit of setup and config (ยปยปยป)
Small codebase, easy to understand and extend (<400 SLOC) Large codebase (thousands of SLOC)
Written in JS Written in Go
New on the scene Mature project
Small feature set Many features
Open source under MPL 2.0 / MIT Open source under APL 2.0
Developed by Shoreditch Ops Developed by Netflix

Why Use Chaos Lambda?

Failures happen, and they inevitably happen when least desired. If your application can't tolerate a system failure would you rather find out by being paged at 3am or after you are in the office having already had your morning coffee? Even if you are confident that your architecture can tolerate a system failure, are you sure it will still be able to next week, how about next month? Software is complex and dynamic, that "simple fix" you put in place last week could have undesired consequences. Do your traffic load balancers correctly detect and route requests around system failures? Can you reliably rebuild your systems? Perhaps an engineer "quick patched" a live system last week and forgot to commit the changes to your source repository?

(source: Chaos Monkey wiki)

Further reading: Principles Of Chaos Engineering

Current Limitations

Supported AWS Regions

Chaos Lambda will only work in these regions (due to a limitation with AWS Lambda Schedules):

  • US East (Northern Virginia)
  • US West (Oregon)
  • Europe (Ireland)
  • Asia Pacific (Tokyo)

Features

Right now, Chaos Lambda only knows how to terminate instances and does not support more advanced interference modes, like introducing extra latency (but it's on the roadmap and being worked on, see Issue #4).

Bonus Points

Want to go further in your pursuit of indestructible systems? Combine Chaos Lambda with stress testing with Artillery.io to ship systems that just keep going.

Support

File an issue or drop us a line on [email protected].

Contributing

Please see the Contributor's Guide

License

MPL 2.0 - see LICENSE.txt for details.

The lambda/index.js file is dual-licensed under MPL 2.0 and MIT and can be used under the terms of either of those licenses.

Contributors


A project by Shoreditch Ops, creators of artillery.io โšก๏ธ - simple & powerful load-testing framework.

More Repositories

1

artillery

The complete load testing platform. Everything you need for production-grade load tests. Serverless & distributed. Load test with Playwright. Load test HTTP APIs, GraphQL, WebSocket, and more. Use any Node.js module.
JavaScript
7,591
star
2

artillery-engine-playwright

CODE MOVED TO MAIN MONOREPO. ๐ŸŒ Load test with real web browsers! Powered by Artillery + Playwright
JavaScript
127
star
3

artillery-plugin-fuzzer

Fuzz testing for HTTP APIs with Artillery.io ๐ŸŒช
JavaScript
59
star
4

scalewright

Tools for running Playwright at scale ๐ŸŽญ ๐Ÿš€
JavaScript
56
star
5

artillery-examples

Ready to run Artillery examples - NOW MOVED INTO THE MAIN REPO
JavaScript
36
star
6

artillery-core

artillery-core - deprecated
JavaScript
29
star
7

artillery-plugin-expect

NOTE: The plugin codebase has been moved into the main Artillery repo. --- Add checks and assertions to your HTTP tests for functional testing with Artillery
JavaScript
27
star
8

artillery-plugin-hls

๐ŸŽฅ Load test HTTP Live Streaming (HLS) servers with Artillery
JavaScript
27
star
9

report-viewer

Report viewer for @artilleryio built in @reactjs @getbootstrap @fontawesome ... Create an easy to read and understand report with crucial data highlights and graphs.
SCSS
26
star
10

artillery-operator

The Artillery Kubernetes Operator
Go
19
star
11

artillery-plugin-publish-metrics

Moved to https://github.com/artilleryio/artillery/tree/main/packages/artillery-plugin-publish-metrics
JavaScript
18
star
12

artillery-engine-kinesis

Experimental AWS Kinesis support for Artillery ๐Ÿ•ณ
JavaScript
13
star
13

action-cli

GitHub Action for load testing with Artillery.
Shell
12
star
14

recorder

HTTP proxy that records requests and creates Artillery test scripts
Python
8
star
15

artillery-plugin-statsd

StatsD publishing plugin for Artillery - DEPRECATED. Please use artillery-plugin-publish-metrics
JavaScript
8
star
16

arrivals

Model the arrival of events in a system (Poisson or constant process)
JavaScript
6
star
17

artillery-plugin-metrics-by-endpoint

This plugin's code is now in the main artillery repo.
JavaScript
5
star
18

artillery-examples-cicd

These examples have been moved into Artillery Examples
3
star
19

artillery-engine-sse

Experimental SSE (server-sent events) support for Artillery
JavaScript
3
star
20

artillery-docker

Official Docker images for Artillery
2
star
21

vscode-artillery

Visual Studio Code extension for Artillery.
TypeScript
2
star
22

artillery-plugin-ensure

This plugin has been moved to the main artillery repo
JavaScript
2
star
23

installer-aws-cdk

AWS CDK-based installer for Artillery dashboard
JavaScript
2
star
24

repl

It's a REPL
JavaScript
1
star