All Projects → adhorn → aws-lambda-chaos-injection

adhorn / aws-lambda-chaos-injection

Licence: MIT license
Chaos Injection library for AWS Lambda

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to aws-lambda-chaos-injection

aws-chaos-scripts
DEPRECATED Collection of python scripts to run failure injection on AWS infrastructure
Stars: ✭ 91 (+10.98%)
Mutual labels:  chaos-monkey, sre, amazon-web-services, chaos-engineering
Chaos Ssm Documents
Collection of AWS SSM Documents to perform Chaos Engineering experiments
Stars: ✭ 225 (+174.39%)
Mutual labels:  sre, amazon-web-services, chaos-engineering
aws-fis-templates-cdk
Collection of AWS Fault Injection Simulator (FIS) experiment templates deploy-able via the AWS CDK
Stars: ✭ 43 (-47.56%)
Mutual labels:  sre, amazon-web-services, chaos-engineering
Wheel Of Misfortune
A role-playing game for incident management training
Stars: ✭ 57 (-30.49%)
Mutual labels:  sre, chaos-engineering
xk6-chaos
xk6 extension for running chaos experiments with k6 💣
Stars: ✭ 18 (-78.05%)
Mutual labels:  sre, chaos-engineering
Howtheyaws
A curated collection of publicly available resources on how technology and tech-savvy organizations around the world use Amazon Web Services (AWS)
Stars: ✭ 389 (+374.39%)
Mutual labels:  sre, amazon-web-services
sample-spring-chaosmonkey
sample applications illustrating usage of codecentric's chaos monkey library for microservices created using spring boot and spring cloud
Stars: ✭ 19 (-76.83%)
Mutual labels:  chaos-monkey, chaos-engineering
chaosmonkey
Go client to the Chaos Monkey REST API
Stars: ✭ 54 (-34.15%)
Mutual labels:  chaos-monkey, chaos-engineering
Awesome Chaos Engineering
A curated list of Chaos Engineering resources.
Stars: ✭ 4,740 (+5680.49%)
Mutual labels:  chaos-monkey, chaos-engineering
Pumba
Chaos testing, network emulation, and stress testing tool for containers
Stars: ✭ 2,136 (+2504.88%)
Mutual labels:  chaos-monkey, chaos-engineering
terraform-aws-lambda-function
A Terraform module for deploying and managing Lambda functions on Amazon Web Services (AWS). https://aws.amazon.com/lambda/
Stars: ✭ 37 (-54.88%)
Mutual labels:  lambda-functions, amazon-web-services
Learn Aws Lambda
✨ Learn how to use AWS Lambda to easily create infinitely scalable web services
Stars: ✭ 910 (+1009.76%)
Mutual labels:  lambda-functions, amazon-web-services
Performance-Engineers-DevOps
This repository helps performance testers and engineers who wants to dive into DevOps and SRE world.
Stars: ✭ 35 (-57.32%)
Mutual labels:  sre, chaos-engineering
Howtheysre
A curated collection of publicly available resources on how technology and tech-savvy organizations around the world practice Site Reliability Engineering (SRE)
Stars: ✭ 6,962 (+8390.24%)
Mutual labels:  sre, chaos-engineering
docker-simianarmy
Docker image of Netflix's Simian Army
Stars: ✭ 74 (-9.76%)
Mutual labels:  chaos-monkey, chaos-engineering
aws-lambda-decorators
A set of Python decorators to simplify AWS lambda development
Stars: ✭ 19 (-76.83%)
Mutual labels:  lambda-functions, amazon-web-services
cli
Reliably CLI - Optimise your operations
Stars: ✭ 2 (-97.56%)
Mutual labels:  sre, chaos-engineering
Aws Serverless Airline Booking
Airline Booking is a sample web application that provides Flight Search, Flight Payment, Flight Booking and Loyalty points including end-to-end testing, GraphQL and CI/CD. This web application was the theme of Build on Serverless Season 2 on AWS Twitch running from April 24th until end of August in 2019.
Stars: ✭ 1,290 (+1473.17%)
Mutual labels:  lambda-functions
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: ✭ 171 (+108.54%)
Mutual labels:  lambda-functions
S3 Lambda
Lambda functions over S3 objects with concurrency control (each, map, reduce, filter)
Stars: ✭ 1,061 (+1193.9%)
Mutual labels:  lambda-functions

Chaos Injection for AWS Lambda - chaos_lambda

Documentation Status Issues Maintenance Pypi Travis Coveralls Twitter

chaos_lambda is a small library injecting chaos into AWS Lambda. It offers simple python decorators to do delay, exception and statusCode injection for your AWS Lambda function. This allows to conduct small chaos engineering experiments for your serverless application in the AWS Cloud.

  • Support for Latency injection using fault_type: latency
  • Support for Exception injection using fault_type: exception
  • Support for HTTP Error status code injection using fault_type: status_code
  • Using for SSM Parameter Store to control the experiment using is_enabled: true
  • Support for adding rate of failure using rate. (Default rate = 1)
  • Per Lambda function injection control using Environment variable (CHAOS_PARAM)

Install

pip install chaos-lambda

Example

# function.py

import os
from chaos_lambda import inject_fault

# this should be set as a Lambda environment variable
os.environ['CHAOS_PARAM'] = 'chaoslambda.config'

@inject_fault
def handler(event, context):
    return {
        'statusCode': 200,
        'body': 'Hello from Lambda!'
    }

Considering a configuration as follows:

{
    "fault_type": "exception",
    "delay": 400,
    "is_enabled": true,
    "error_code": 404,
    "exception_msg": "This is chaos",
    "rate": 1
}

When excecuted, the Lambda function, e.g handler('foo', 'bar'), will produce the following result:

exception_msg from config chaos with a rate of 1
corrupting now
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../chaos_lambda.py", line 199, in wrapper
    raise Exception(exception_msg)
Exception: This is chaos

Configuration

The configuration for the failure injection is stored in the AWS SSM Parameter Store and accessed at runtime by the get_config() function:

{
    "fault_type": "exception",
    "delay": 400,
    "is_enabled": true,
    "error_code": 404,
    "exception_msg": "This is chaos",
    "rate": 1
}

To store the above configuration into SSM using the AWS CLI do the following:

aws ssm put-parameter --name chaoslambda.config --type String --overwrite --value "{ "delay": 400, "is_enabled": true, "error_code": 404, "exception_msg": "This is chaos", "rate": 1, "fault_type": "exception"}" --region eu-west-1

AWS Lambda will need to have IAM access to SSM.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "ssm:DescribeParameters"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ssm:GetParameters",
                "ssm:GetParameter"
            ],
            "Resource": "arn:aws:ssm:eu-north-1:12345678910:parameter/chaoslambda.config"
        }
    ]
}

Supported Faults:

chaos_lambda currently supports the following faults:

  • latency - Add latency in the AWS Lambda execution
  • exception - Raise an exception during the AWS Lambda execution
  • status_code - force AWS Lambda to return a specific HTTP error code

More information:

Full Documentation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].