DEV Community

mikotian
mikotian

Posted on

1 2

Setting up ChaosToolkit Execution Environment

Base Setup

Install Python 3.5 on your execution machine.

Windows : Download the latest binary installer from the Python website.

Linux: https://www.python.org/download/other/

Create a virtual environment. Virtual environments help us encapsulate our changes away from the larger system.

python3 -m venv ~/.venvs/resilient

source ~/.venvs/resilient/bin/activate
Enter fullscreen mode Exit fullscreen mode

Install chaostoolkit

pip install chaostoolkit
Enter fullscreen mode Exit fullscreen mode

Verify version

chaos --version
Enter fullscreen mode Exit fullscreen mode

This will install the base version of chaostoolkit with its inbuilt probes, tolerances & actions.

Install AWS Drivers

pip install -U chaostoolkit-aws
Enter fullscreen mode Exit fullscreen mode

Passing Credentials to ChaosToolkit.

For AWS actions/probes to work as expected we need to place a credentials file like below in the following location. ~/.aws

The credentials can be added in the experiment itself, like so

{
  "secrets": {
    "aws": {
      "aws_access_key_id": "your key",
      "aws_secret_access_key": "access key",
      "aws_session_token": "token"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Thats it, you're all set to run AWS Chaos/resiliency experiments!

Install Toxiproxy Drivers

Install Toxiproxy Server from here: (https://github.com/Shopify/toxiproxy/releases)

Install the toxiproxy CLI (https://github.com/Shopify/toxiproxy/releases)

These are required in order to make the network changes work.

Install the chaos toolkit drivers:

pip install -U chaostoolkit-toxiproxy
Enter fullscreen mode Exit fullscreen mode

Add the following configuration to your experiment.

"configuration": {
    "toxiproxy_host" : "10.124.23.183",
    "some_environment_variable": {
      "type": "environment",
      "key": "ENVIRONMENT_VARIABLE"
    }
  }
Enter fullscreen mode Exit fullscreen mode

Start the toxiproxy server.

Now you are ready to run the experiment.

Image of Datadog

The Essential Toolkit for Front-end Developers

Take a user-centric approach to front-end monitoring that evolves alongside increasingly complex frameworks and single-page applications.

Get The Kit

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More