Extension chaosaws

Version 0.12.0
Repository https://github.com/chaostoolkit-incubator/chaostoolkit-aws

Build Status Python versions

This project is a collection of actions and probes, gathered as an extension to the Chaos Toolkit.

Install

This package requires Python 3.5+

To be used from your experiment, this package must be installed in the Python environment where chaostoolkit already lives.

$ pip install -U chaostoolkit-aws

Usage

To use the probes and actions from this package, add the following to your experiment file:

{
    "name": "stop-an-ec2-instance",
    "provider": {
        "type": "python",
        "module": "chaosaws.ec2.actions",
        "func": "stop_instance",
        "arguments": {
            "instance_id": "i-123456"
        }
    }
},
{
    "name": "create-a-new-policy",
    "provider": {
        "type": "python",
        "module": "chaosaws.iam.actions",
        "func": "create_policy",
        "arguments": {
            "name": "mypolicy",
            "path": "user/Jane",
            "policy": {
                "Version": "2012-10-17",
                "Statement": [
                    {
                        "Effect": "Allow",
                        "Action": [
                            "s3:ListAllMyBuckets",
                            "s3:GetBucketLocation"
                        ],
                        "Resource": "arn:aws:s3:::*"
                    }
                ]
            }
        }
    }
}

Or select one at random from an AZ:

{
    "name": "stop-an-ec2-instance-in-az-at-random",
    "provider": {
        "type": "python",
        "module": "chaosaws.ec2.actions",
        "func": "stop_instance",
        "arguments": {
            "az": "us-west-1"
        }
    }
}

That’s it!

Please explore the code to see existing probes and actions.

Configuration

Credentials

This extension uses the boto3 library under the hood. This library expects that you have properly configured your environment to connect and authenticate with the AWS services.

Use default profile from ~/.aws/credentials or ~/.aws/config

This is the most basic case, assuming your default profile is properly configured in ~/.aws/credentials (or ~/.aws/config), then you do not need to pass any specific credentials to the experiment.

Use a non-default profile from ~/.aws/credentials or ~/.aws/config

Assuming you have configure a profile in your ~/.aws/credentials (or ~/.aws/config) file, you may declare it in your experiment as follows:

{
    "configuration": {
        "aws_profile_name": "dev"
    }
}

Your ~/.aws/credentials should look like this:

[dev]
aws_access_key_id = XYZ
aws_secret_access_key = UIOPIY

Or, your ~/.aws/config should look like this:

[profile dev]
output = json
aws_access_key_id = XYZ
aws_secret_access_key = UIOPIY

Assume an ARN role from a non-default profile

Assuming you have configure a profile in your ~/.aws/config file with a specific ARN role you want to assume during the run:

{
    "configuration": {
        "aws_profile_name": "dev"
    }
}

Your ~/.aws/config should look like this:

[default]
output = json

[profile dev]
role_arn = arn:aws:iam::XXXXXXX:role/role-name
source_profile = default

Assume an ARN role from within the experiment

You mays also assume a role by declaring the role ARN in the experiment directly. In that case, the profile has no impact if you also set it.

    "configuration": {
        "aws_assume_role_arn": "arn:aws:iam::XXXXXXX:role/role-name",
        "aws_assume_role_session_name": "my-chaos"
    }

The aws_assume_role_session_name key is optional and will be set to "ChaosToolkit" when not provided.

When this approach is used, the extension performs a assume role call against the AWS STS service to fetch credentials dynamically.

Pass credentials explicitely

You can pass the credentials as a secret to the experiment definition as follows:

{
    "secrets": {
        "aws": {
            "aws_access_key_id": "your key",
            "aws_secret_access_key": "access key",
            "aws_session_token": "token",
        }
    }
}
Note that the token is optional.

Then, use it as follows:

{
    "name": "stop-an-ec2-instance",
    "provider": {
        "type": "python",
        "module": "chaosaws.ec2.actions",
        "func": "stop_instance",
        "secrets": ["aws"],
        "arguments": {
            "instance_id": "i-123456"
        }
    }
}

Setting the region

In additon to the authentication credentials, you must configure the region against which you want to use.

You can either declare it at the top level of the experiment, add:

{
    "configuration": {
        "aws_region": "us-east-1"
    }
}

or

{
    "configuration": {
        "aws_region": {
            "env": "type",
            "key": "AWS_REGION"
        }
    }
}

But you can also simply set either AWS_REGION or AWS_DEFAULT_REGION in your terminal session without declaring anything in the experiment.

If none of these are set, your experiment will likely fail.

Contribute

If you wish to contribute more functions to this package, you are more than welcome to do so. Please, fork this project, make your changes following the usual PEP 8 code style, sprinkling with tests and submit a PR for review.

The Chaos Toolkit projects require all contributors must sign a Developer Certificate of Origin on each commit they would like to merge into the master branch of the repository. Please, make sure you can abide by the rules of the DCO before submitting a PR.

Develop

If you wish to develop on this project, make sure to install the development dependencies. But first, create a virtual environment and then install those dependencies.

$ pip install -r requirements-dev.txt -r requirements.txt 

Then, point your environment to this directory:

$ python setup.py develop

Now, you can edit the files and they will be automatically be seen by your environment, even when running from the chaos command locally.

Test

To run the tests for the project execute the following:

$ pytest

Add new AWS API Support

Once you have setup your environment, you can start adding new AWS API support by adding new actions, probes and entire sub-packages for those.

Services supported by boto

This package relies on boto3 to wrap the API calls into a fluent Python API. Some newer AWS services are not yet available in boto3, in that case, you should read the next section.

Let’s say you want to support a new action in the EC2 sub-package.

Start by creating a new function in ec2/actions.py:

from chaoslib.types import Configuration, Secrets

from chaosaws import aws_client
from chaosaws.types import AWSResponse

def reboot_instance(instance_id: str, dry_run: bool=False,
                    configuration: Configuration=None,
                    secrets: Secrets=None) -> AWSResponse:
    """
    Reboot a given EC2 instance.
    """
    client = aws_client('ec2', configuration, secrets)
    return client.reboot_instances(InstanceIds=[instance_id], DryRun=dry_run)

As you can see, the actual code is straightforward. You first create a EC2 client and simply call the appropriate method on that client with the expected arguments. We return the action as-is so that it can be logged by the chaostoolkit, or even be used as part of a steady-state hypothesis probe (if this was a probe, not action that is).

You could decide to make more than one AWS API call but, it is better to keep it simple so that composition is easier from the experiment. Nonetheless, you may also compose those directly into a single action as well for specific use-cases.

Please refer to the Chaos Toolkit documentation to learn more about the configuration and secrets objects.

Once you have implemented that action, you must create at least one unit test for it in the tests/ec2/test_ec2_actions.py test module. For example:

from chaosaws.ec2.actions import reboot_instancex

@patch('chaosaws.ec2.actions.aws_client', autospec=True)
def test_reboot_instance(aws_client):
    client = MagicMock()
    aws_client.return_value = client
    inst_id = "i-1234567890abcdef0"
    response = reboot_instance(inst_id)
    client.reboot_instances.assert_called_with(
        InstanceIds=[inst_id], DryRun=False)

By using the built-in Python module to mock objects, we can mock the EC2 client and assert we edo indeed call the appropriate method with the right arguments. You are encouraged to write more than a single test for various conditions.

Finally, should you choose to add support for a new AWS API resource altogether, you should create the according sub-package.

Services not supported by boto (new AWS features)

If the support you want to provide is for a new AWS service that boto does not support yet, this requires direct call to the API endpoint via the requests package. Say we have a new service, not yet supported by boto3

from chaoslib.types import Configuration, Secrets

from chaosaws import signed_api_call
from chaosaws.types import AWSResponse

def terminate_worker_node(worker_node_id: str,
                          configuration: Configuration=None,
                          secrets: Secrets=None) -> AWSResponse:
    """
    Terminate a worker node.
    """
    params = {
        "DryRun": True,
        "WorkerNodeId.1": worker_node_id
    }
    response = signed_api_call(
        'some-new-service-name', path='/2018-01-01/worker/terminate',
        method='POST', params=params,
        configuration=configuration, secrets=secrets)
    return response.json()

Here is an example on existing API call (as a more concrete snippet):

from chaoslib.types import Configuration, Secrets

from chaosaws import signed_api_call

def stop_instance(instance_id: str, configuration: Configuration=None,
                  secrets: Secrets=None) -> str:
    response = signed_api_call(
        'ec2',
        configuration=configuration,
        secrets=secrets,
        params={
            "Action": "StopInstances",
            "InstanceId.1": instance_id,
            "Version": "2013-06-15"
        }
    )

    # this API returns XML, not JSON
    return response.text

When using the signed_api_call, you are responsible for the right way of passing the parameters. Basically, look at the AWS documentation for each API call.

WARNING: It should be noted that, whenever boto3 implements an API, this package should be updated accordingly, as boto3 is much more versatile and solid.

Make your new sub-package discoverable

Finally, if you have created a new sub-package entirely, you need to make its capability discoverable by the chaos toolkit. Simply amend the discover function in the chaosaws/__init__.py. For example, assuming a new eks sub-package, with actions and probes:

    activities.extend(discover_actions("chaosaws.eks.actions"))
    activities.extend(discover_probes("chaosaws.eks.probes"))

Exported Activities

rds


delete_db_cluster

Type action
Module chaosaws.rds.actions
Name delete_db_cluster
Return mapping

Deletes an Aurora DB cluster

  • db_cluster_identifier: the identifier of the cluster to delete
  • skip_final_snapshot: boolean (true): determines whether or not to perform a final snapshot of the cluster before deletion
  • db_snapshot_identifier: the identifier to give the final rds snapshot

Signature:

def delete_db_cluster(
        db_cluster_identifier: str,
        skip_final_snapshot: bool = True,
        db_snapshot_identifier: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_cluster_identifier string Yes
skip_final_snapshot boolean true No
db_snapshot_identifier string null No

Usage:

{
  "name": "delete-db-cluster",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_db_cluster",
    "arguments": {
      "db_cluster_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: delete-db-cluster
provider:
  arguments:
    db_cluster_identifier: ''
  func: delete_db_cluster
  module: chaosaws.rds.actions
  type: python
type: action

delete_db_cluster_endpoint

Type action
Module chaosaws.rds.actions
Name delete_db_cluster_endpoint
Return mapping

Deletes the custom endpoint of an Aurora cluster

  • db_cluster_identifier: the identifier of the cluster to delete the endpoint from

Signature:

def delete_db_cluster_endpoint(
        db_cluster_identifier: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_cluster_identifier string Yes

Usage:

{
  "name": "delete-db-cluster-endpoint",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_db_cluster_endpoint",
    "arguments": {
      "db_cluster_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: delete-db-cluster-endpoint
provider:
  arguments:
    db_cluster_identifier: ''
  func: delete_db_cluster_endpoint
  module: chaosaws.rds.actions
  type: python
type: action

delete_db_instance

Type action
Module chaosaws.rds.actions
Name delete_db_instance
Return mapping

Deletes a RDS instance

  • db_instance_identifier: the identifier of the RDS instance to delete
  • skip_final_snapshot: boolean (true): determines whether or not to perform a final snapshot of the rds instance before deletion
  • db_snapshot_identifier: the identifier to give the final rds snapshot
  • delete_automated_backups: boolean (true): determines if the automated backups of the rds instance are deleted immediately

Signature:

def delete_db_instance(
        db_instance_identifier: str,
        skip_final_snapshot: bool = True,
        db_snapshot_identifier: str = None,
        delete_automated_backups: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_instance_identifier string Yes
skip_final_snapshot boolean true No
db_snapshot_identifier string null No
delete_automated_backups boolean true No

Usage:

{
  "name": "delete-db-instance",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_db_instance",
    "arguments": {
      "db_instance_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: delete-db-instance
provider:
  arguments:
    db_instance_identifier: ''
  func: delete_db_instance
  module: chaosaws.rds.actions
  type: python
type: action

failover_db_cluster

Type action
Module chaosaws.rds.actions
Name failover_db_cluster
Return mapping

Forces a failover for a DB cluster.

Signature:

def failover_db_cluster(
        db_cluster_identifier: str,
        target_db_instance_identifier: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_cluster_identifier string Yes
target_db_instance_identifier string null No

Usage:

{
  "name": "failover-db-cluster",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "failover_db_cluster",
    "arguments": {
      "db_cluster_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: failover-db-cluster
provider:
  arguments:
    db_cluster_identifier: ''
  func: failover_db_cluster
  module: chaosaws.rds.actions
  type: python
type: action

reboot_db_instance

Type action
Module chaosaws.rds.actions
Name reboot_db_instance
Return mapping

Forces a reboot of your DB instance.

Signature:

def reboot_db_instance(
        db_instance_identifier: str,
        force_failover: bool = False,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_instance_identifier string Yes
force_failover boolean false No

Usage:

{
  "name": "reboot-db-instance",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "reboot_db_instance",
    "arguments": {
      "db_instance_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: reboot-db-instance
provider:
  arguments:
    db_instance_identifier: ''
  func: reboot_db_instance
  module: chaosaws.rds.actions
  type: python
type: action

stop_db_cluster

Type action
Module chaosaws.rds.actions
Name stop_db_cluster
Return mapping

Stop a RDS Cluster

  • db_cluster_identifier: the identifier of the RDS cluster to stop

Signature:

def stop_db_cluster(
        db_cluster_identifier: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_cluster_identifier string Yes

Usage:

{
  "name": "stop-db-cluster",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "stop_db_cluster",
    "arguments": {
      "db_cluster_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: stop-db-cluster
provider:
  arguments:
    db_cluster_identifier: ''
  func: stop_db_cluster
  module: chaosaws.rds.actions
  type: python
type: action

stop_db_instance

Type action
Module chaosaws.rds.actions
Name stop_db_instance
Return mapping

Stops a RDS DB instance

  • db_instance_identifier: the instance identifier of the RDS instance
  • db_snapshot_identifier: the name of the DB snapshot made before stop

Signature:

def stop_db_instance(
        db_instance_identifier: str,
        db_snapshot_identifier: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
db_instance_identifier string Yes
db_snapshot_identifier string null No

Usage:

{
  "name": "stop-db-instance",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "stop_db_instance",
    "arguments": {
      "db_instance_identifier": ""
    },
    "module": "chaosaws.rds.actions"
  }
}
name: stop-db-instance
provider:
  arguments:
    db_instance_identifier: ''
  func: stop_db_instance
  module: chaosaws.rds.actions
  type: python
type: action

cloudwatch


delete_rule

Type action
Module chaosaws.cloudwatch.actions
Name delete_rule
Return mapping

Deletes a CloudWatch rule.

All rule targets must be removed before deleting the rule. Set input argument force to True to force all rule targets to be deleted.

Signature:

def delete_rule(rule_name: str,
                force: bool = False,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
rule_name string Yes
force boolean false No

Usage:

{
  "name": "delete-rule",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_rule",
    "arguments": {
      "rule_name": ""
    },
    "module": "chaosaws.cloudwatch.actions"
  }
}
name: delete-rule
provider:
  arguments:
    rule_name: ''
  func: delete_rule
  module: chaosaws.cloudwatch.actions
  type: python
type: action

disable_rule

Type action
Module chaosaws.cloudwatch.actions
Name disable_rule
Return mapping

Disables a CloudWatch rule.

Signature:

def disable_rule(rule_name: str,
                 configuration: Dict[str, Dict[str, str]] = None,
                 secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
rule_name string Yes

Usage:

{
  "name": "disable-rule",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "disable_rule",
    "arguments": {
      "rule_name": ""
    },
    "module": "chaosaws.cloudwatch.actions"
  }
}
name: disable-rule
provider:
  arguments:
    rule_name: ''
  func: disable_rule
  module: chaosaws.cloudwatch.actions
  type: python
type: action

enable_rule

Type action
Module chaosaws.cloudwatch.actions
Name enable_rule
Return mapping

Enables a CloudWatch rule.

Signature:

def enable_rule(rule_name: str,
                configuration: Dict[str, Dict[str, str]] = None,
                secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
rule_name string Yes

Usage:

{
  "name": "enable-rule",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "enable_rule",
    "arguments": {
      "rule_name": ""
    },
    "module": "chaosaws.cloudwatch.actions"
  }
}
name: enable-rule
provider:
  arguments:
    rule_name: ''
  func: enable_rule
  module: chaosaws.cloudwatch.actions
  type: python
type: action

get_alarm_state_value

Type probe
Module chaosaws.cloudwatch.probes
Name get_alarm_state_value
Return string

Return the state value of an alarm.

The possbile alarm state values are described in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.describe_alarms

Signature:

def get_alarm_state_value(alarm_name: str,
                          configuration: Dict[str, Dict[str, str]] = None,
                          secrets: Dict[str, Dict[str, str]] = None) -> str:
    pass

Arguments:

Name Type Default Required
alarm_name string Yes

Usage:

{
  "name": "get-alarm-state-value",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "get_alarm_state_value",
    "arguments": {
      "alarm_name": ""
    },
    "module": "chaosaws.cloudwatch.probes"
  }
}
name: get-alarm-state-value
provider:
  arguments:
    alarm_name: ''
  func: get_alarm_state_value
  module: chaosaws.cloudwatch.probes
  type: python
type: probe

get_metric_statistics

Type probe
Module chaosaws.cloudwatch.probes
Name get_metric_statistics
Return None

Get the value of a statistical calculation for a given metric.

The period for which the calculation will be performed is specified by a duration and an offset from the current time. Both are specified in seconds.

Example: A duration of 60 seconds and an offset of 30 seconds will yield a statistical value based on the time interval between 30 and 90 seconds in the past.

More information about input parameters are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/cloudwatch.html#CloudWatch.Client.get_metric_statistics

Signature:

def get_metric_statistics(namespace: str,
                          metric_name: str,
                          dimension_name: str,
                          dimension_value: str,
                          duration: int = 60,
                          offset: int = 0,
                          statistic: str = None,
                          extended_statistic: str = None,
                          unit: str = None,
                          configuration: Dict[str, Dict[str, str]] = None,
                          secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
namespace string Yes
metric_name string Yes
dimension_name string Yes
dimension_value string Yes
duration integer 60 No
offset integer 0 No
statistic string null No
extended_statistic string null No
unit string null No

Usage:

{
  "name": "get-metric-statistics",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "get_metric_statistics",
    "arguments": {
      "dimension_value": "",
      "namespace": "",
      "dimension_name": "",
      "metric_name": ""
    },
    "module": "chaosaws.cloudwatch.probes"
  }
}
name: get-metric-statistics
provider:
  arguments:
    dimension_name: ''
    dimension_value: ''
    metric_name: ''
    namespace: ''
  func: get_metric_statistics
  module: chaosaws.cloudwatch.probes
  type: python
type: probe

put_rule

Type action
Module chaosaws.cloudwatch.actions
Name put_rule
Return mapping

Creates or updates a CloudWatch event rule.

Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#CloudWatchEvents.Client.put_rule for details on input arguments.

Signature:

def put_rule(rule_name: str,
             schedule_expression: str = None,
             event_pattern: str = None,
             state: str = None,
             description: str = None,
             role_arn: str = None,
             configuration: Dict[str, Dict[str, str]] = None,
             secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
rule_name string Yes
schedule_expression string null No
event_pattern string null No
state string null No
description string null No
role_arn string null No

Usage:

{
  "name": "put-rule",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "put_rule",
    "arguments": {
      "rule_name": ""
    },
    "module": "chaosaws.cloudwatch.actions"
  }
}
name: put-rule
provider:
  arguments:
    rule_name: ''
  func: put_rule
  module: chaosaws.cloudwatch.actions
  type: python
type: action

put_rule_targets

Type action
Module chaosaws.cloudwatch.actions
Name put_rule_targets
Return mapping

Creates or update CloudWatch event rule targets.

Please refer to https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/events.html#CloudWatchEvents.Client.put_targets for details on input arguments.

Signature:

def put_rule_targets(
        rule_name: str,
        targets: List[Dict[str, Any]],
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
rule_name string Yes
targets list Yes

Usage:

{
  "name": "put-rule-targets",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "put_rule_targets",
    "arguments": {
      "targets": [],
      "rule_name": ""
    },
    "module": "chaosaws.cloudwatch.actions"
  }
}
name: put-rule-targets
provider:
  arguments:
    rule_name: ''
    targets: []
  func: put_rule_targets
  module: chaosaws.cloudwatch.actions
  type: python
type: action

remove_rule_targets

Type action
Module chaosaws.cloudwatch.actions
Name remove_rule_targets
Return mapping

Removes CloudWatch rule targets. If no target ids are provided all targets will be removed.

Signature:

def remove_rule_targets(
        rule_name: str,
        target_ids: List[str] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
rule_name string Yes
target_ids list null No

Usage:

{
  "name": "remove-rule-targets",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "remove_rule_targets",
    "arguments": {
      "rule_name": ""
    },
    "module": "chaosaws.cloudwatch.actions"
  }
}
name: remove-rule-targets
provider:
  arguments:
    rule_name: ''
  func: remove_rule_targets
  module: chaosaws.cloudwatch.actions
  type: python
type: action

elbv2


all_targets_healthy

Type probe
Module chaosaws.elbv2.probes
Name all_targets_healthy
Return mapping

Return true/false based on if all targets for listed target groups are healthy

Signature:

def all_targets_healthy(
        tg_names: List[str],
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
tg_names list Yes

Usage:

{
  "name": "all-targets-healthy",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "all_targets_healthy",
    "arguments": {
      "tg_names": []
    },
    "module": "chaosaws.elbv2.probes"
  }
}
name: all-targets-healthy
provider:
  arguments:
    tg_names: []
  func: all_targets_healthy
  module: chaosaws.elbv2.probes
  type: python
type: probe

delete_load_balancer

Type action
Module chaosaws.elbv2.actions
Name delete_load_balancer
Return None

Deletes the provided load balancer(s).

Parameters: - load_balancer_names: a list of load balancer names

Signature:

def delete_load_balancer(load_balancer_names: List[str],
                         configuration: Dict[str, Dict[str, str]] = None,
                         secrets: Dict[str, Dict[str, str]] = None):
    pass

Arguments:

Name Type Default Required
load_balancer_names list Yes

Usage:

{
  "name": "delete-load-balancer",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_load_balancer",
    "arguments": {
      "load_balancer_names": []
    },
    "module": "chaosaws.elbv2.actions"
  }
}
name: delete-load-balancer
provider:
  arguments:
    load_balancer_names: []
  func: delete_load_balancer
  module: chaosaws.elbv2.actions
  type: python
type: action

deregister_target

Type action
Module chaosaws.elbv2.actions
Name deregister_target
Return mapping

Deregisters one random target from target group

Signature:

def deregister_target(
        tg_name: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
tg_name string Yes

Usage:

{
  "name": "deregister-target",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "deregister_target",
    "arguments": {
      "tg_name": ""
    },
    "module": "chaosaws.elbv2.actions"
  }
}
name: deregister-target
provider:
  arguments:
    tg_name: ''
  func: deregister_target
  module: chaosaws.elbv2.actions
  type: python
type: action

set_security_groups

Type action
Module chaosaws.elbv2.actions
Name set_security_groups
Return list

Changes the security groups for the specified load balancer(s). This action will replace the existing security groups on an application load balancer with the specified security groups.

Parameters: - load_balancer_names: a list of load balancer names - security_group_ids: a list of security group ids

returns: [ { ‘LoadBalancerArn’: ‘string’, ‘SecurityGroupIds’: [‘sg-0000000’, ‘sg-0000001’] }, … ]

Signature:

def set_security_groups(
        load_balancer_names: List[str],
        security_group_ids: List[str],
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
load_balancer_names list Yes
security_group_ids list Yes

Usage:

{
  "name": "set-security-groups",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "set_security_groups",
    "arguments": {
      "security_group_ids": [],
      "load_balancer_names": []
    },
    "module": "chaosaws.elbv2.actions"
  }
}
name: set-security-groups
provider:
  arguments:
    load_balancer_names: []
    security_group_ids: []
  func: set_security_groups
  module: chaosaws.elbv2.actions
  type: python
type: action

set_subnets

Type action
Module chaosaws.elbv2.actions
Name set_subnets
Return list

Changes the subnets for the specified application load balancer(s) This action will replace the existing security groups on an application load balancer with the specified security groups.

Parameters: - load_balancer_names: a list of load balancer names - subnet_ids: a list of subnet ids

returns: [ { ‘LoadBalancerArn’: ‘string’, ‘AvailabilityZones’: { ‘ZoneName’: ‘string’, ‘SubnetId’: ‘string’, ‘LoadBalancerAddresses’: [ { ‘IpAddress’: ‘string’, ‘AllocationId’: ‘string’ } ] } }, … ]

Signature:

def set_subnets(
        load_balancer_names: List[str],
        subnet_ids: List[str],
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
load_balancer_names list Yes
subnet_ids list Yes

Usage:

{
  "name": "set-subnets",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "set_subnets",
    "arguments": {
      "subnet_ids": [],
      "load_balancer_names": []
    },
    "module": "chaosaws.elbv2.actions"
  }
}
name: set-subnets
provider:
  arguments:
    load_balancer_names: []
    subnet_ids: []
  func: set_subnets
  module: chaosaws.elbv2.actions
  type: python
type: action

targets_health_count

Type probe
Module chaosaws.elbv2.probes
Name targets_health_count
Return mapping

Count of healthy/unhealthy targets per targetgroup

Signature:

def targets_health_count(
        tg_names: List[str],
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
tg_names list Yes

Usage:

{
  "name": "targets-health-count",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "targets_health_count",
    "arguments": {
      "tg_names": []
    },
    "module": "chaosaws.elbv2.probes"
  }
}
name: targets-health-count
provider:
  arguments:
    tg_names: []
  func: targets_health_count
  module: chaosaws.elbv2.probes
  type: python
type: probe

ecs


are_all_desired_tasks_running

Type probe
Module chaosaws.ecs.probes
Name are_all_desired_tasks_running
Return boolean

Checks to make sure desired and running tasks counts are equal

Signature:

def are_all_desired_tasks_running(
        cluster: str,
        service: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
cluster string Yes
service string Yes

Usage:

{
  "name": "are-all-desired-tasks-running",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "are_all_desired_tasks_running",
    "arguments": {
      "cluster": "",
      "service": ""
    },
    "module": "chaosaws.ecs.probes"
  }
}
name: are-all-desired-tasks-running
provider:
  arguments:
    cluster: ''
    service: ''
  func: are_all_desired_tasks_running
  module: chaosaws.ecs.probes
  type: python
type: probe

delete_cluster

Type action
Module chaosaws.ecs.actions
Name delete_cluster
Return mapping

Delete a given ECS cluster

Signature:

def delete_cluster(
        cluster: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string Yes

Usage:

{
  "name": "delete-cluster",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_cluster",
    "arguments": {
      "cluster": ""
    },
    "module": "chaosaws.ecs.actions"
  }
}
name: delete-cluster
provider:
  arguments:
    cluster: ''
  func: delete_cluster
  module: chaosaws.ecs.actions
  type: python
type: action

delete_service

Type action
Module chaosaws.ecs.actions
Name delete_service
Return mapping

Update a given ECS service by updating it to set the desired count of tasks to 0 then delete it. If not provided, a random one will be picked up regarding service_pattern, if provided, so that only service names matching the pattern would be be used. This should be a valid regex.

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Signature:

def delete_service(
        service: str = None,
        cluster: str = None,
        service_pattern: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
service string null No
cluster string null No
service_pattern string null No

Usage:

{
  "name": "delete-service",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_service",
    "module": "chaosaws.ecs.actions"
  }
}
name: delete-service
provider:
  func: delete_service
  module: chaosaws.ecs.actions
  type: python
type: action

deregister_container_instance

Type action
Module chaosaws.ecs.actions
Name deregister_container_instance
Return mapping

Deregister a given ECS container. Becareful that tasks handled by this instance will remain orphan.

Signature:

def deregister_container_instance(
        cluster: str,
        instance_id: str,
        force: bool = False,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string Yes
instance_id string Yes
force boolean false No

Usage:

{
  "name": "deregister-container-instance",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "deregister_container_instance",
    "arguments": {
      "cluster": "",
      "instance_id": ""
    },
    "module": "chaosaws.ecs.actions"
  }
}
name: deregister-container-instance
provider:
  arguments:
    cluster: ''
    instance_id: ''
  func: deregister_container_instance
  module: chaosaws.ecs.actions
  type: python
type: action

describe_cluster

Type probe
Module chaosaws.ecs.probes
Name describe_cluster
Return mapping

Returns AWS response describing the specified cluster

Probe example: “steady-state-hypothesis”: { “title”: “MyCluster has 3 running tasks”, “probes”: [{ “type”: “probe”, “name”: “Cluster running task count”, “tolerance”: { “type”: “jsonpath”, “path”: $.clusters[0].runningTasksCount, “expect”: 3 }, “provider”: { “type”: “python”, “module”: “chaosaws.ecs.probes”, “func”: “describe_cluster”, “arguments”: { “cluster”: “MyCluster” } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_clusters

Signature:

def describe_cluster(
        cluster: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string Yes

Usage:

{
  "name": "describe-cluster",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "describe_cluster",
    "arguments": {
      "cluster": ""
    },
    "module": "chaosaws.ecs.probes"
  }
}
name: describe-cluster
provider:
  arguments:
    cluster: ''
  func: describe_cluster
  module: chaosaws.ecs.probes
  type: python
type: probe

describe_service

Type probe
Module chaosaws.ecs.probes
Name describe_service
Return mapping

Returns AWS response describing the specified cluster service

Probe example: “steady-state-hypothesis”: { “title”: “MyService pending count is 1”, “probes”: [{ “type”: “probe”, “name”: “Service pending count”, “tolerance”: { “type”: “jsonpath”, “path”: $.services[0].pendingCount, “expect”: 1 }, “provider”: { “type”: “python”, “module”: “chaosaws.ecs.probes”, “func”: “describe_service”, “arguments”: { “cluster”: “MyCluster”, “service”: “MyService” } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_services

Signature:

def describe_service(
        cluster: str,
        service: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string Yes
service string Yes

Usage:

{
  "name": "describe-service",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "describe_service",
    "arguments": {
      "cluster": "",
      "service": ""
    },
    "module": "chaosaws.ecs.probes"
  }
}
name: describe-service
provider:
  arguments:
    cluster: ''
    service: ''
  func: describe_service
  module: chaosaws.ecs.probes
  type: python
type: probe

describe_tasks

Type probe
Module chaosaws.ecs.probes
Name describe_tasks
Return mapping

Returns AWS response describing the tasks for a provided cluster

Probe example: “steady-state-hypothesis”: { “title”: “MyCluster tasks are healthy”, “probes”: [{ “type”: “probe”, “name”: “first task is healthy”, “tolerance”: { “type”: “jsonpath”, “path”: $.tasks[0].healthStatus, “expect”: “HEALTHY” }, “provider”: { “type”: “python”, “module”: “chaosaws.ecs.probes”, “func”: “describe_tasks”, “arguments”: { “cluster”: “MyCluster” } } }] }

Full list of possible paths can be found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs.html#ECS.Client.describe_tasks

Signature:

def describe_tasks(
        cluster: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string Yes

Usage:

{
  "name": "describe-tasks",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "describe_tasks",
    "arguments": {
      "cluster": ""
    },
    "module": "chaosaws.ecs.probes"
  }
}
name: describe-tasks
provider:
  arguments:
    cluster: ''
  func: describe_tasks
  module: chaosaws.ecs.probes
  type: python
type: probe

service_is_deploying

Type probe
Module chaosaws.ecs.probes
Name service_is_deploying
Return boolean

Checks to make sure there is not an in progress deployment

Signature:

def service_is_deploying(cluster: str,
                         service: str,
                         configuration: Dict[str, Dict[str, str]] = None,
                         secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
cluster string Yes
service string Yes

Usage:

{
  "name": "service-is-deploying",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "service_is_deploying",
    "arguments": {
      "cluster": "",
      "service": ""
    },
    "module": "chaosaws.ecs.probes"
  }
}
name: service-is-deploying
provider:
  arguments:
    cluster: ''
    service: ''
  func: service_is_deploying
  module: chaosaws.ecs.probes
  type: python
type: probe

stop_random_tasks

Type action
Module chaosaws.ecs.actions
Name stop_random_tasks
Return mapping

Stop a random number of tasks based on given task_count or task_percent

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Parameters: Required: - cluster: name of the cluster to stop tasks in

        Optional:
            - service: name of the service to stop tasks in

        One Of:
            - task_count: the number of tasks to stop
            - task_percent: the percentage of tasks to stop

Signature:

def stop_random_tasks(
        cluster: str = None,
        task_count: int = None,
        task_percent: int = None,
        service: str = None,
        reason: str = 'Chaos Testing',
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string null No
task_count integer null No
task_percent integer null No
service string null No
reason string “Chaos Testing” No

Usage:

{
  "name": "stop-random-tasks",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "stop_random_tasks",
    "module": "chaosaws.ecs.actions"
  }
}
name: stop-random-tasks
provider:
  func: stop_random_tasks
  module: chaosaws.ecs.actions
  type: python
type: action

stop_task

Type action
Module chaosaws.ecs.actions
Name stop_task
Return mapping

Stop a given ECS task instance. If no task_id provided, a random task of the given service is stopped.

You can specify a cluster by its ARN identifier or, if not provided, the default cluster will be picked up.

Signature:

def stop_task(cluster: str = None,
              task_id: str = None,
              service: str = None,
              reason: str = 'Chaos Testing',
              configuration: Dict[str, Dict[str, str]] = None,
              secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
cluster string null No
task_id string null No
service string null No
reason string “Chaos Testing” No

Usage:

{
  "name": "stop-task",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "stop_task",
    "module": "chaosaws.ecs.actions"
  }
}
name: stop-task
provider:
  func: stop_task
  module: chaosaws.ecs.actions
  type: python
type: action

awslambda


delete_function_concurrency

Type action
Module chaosaws.awslambda.actions
Name delete_function_concurrency
Return mapping

Removes concurrency limit applied to the specified Lambda

Signature:

def delete_function_concurrency(
        function_name: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
function_name string Yes

Usage:

{
  "name": "delete-function-concurrency",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_function_concurrency",
    "arguments": {
      "function_name": ""
    },
    "module": "chaosaws.awslambda.actions"
  }
}
name: delete-function-concurrency
provider:
  arguments:
    function_name: ''
  func: delete_function_concurrency
  module: chaosaws.awslambda.actions
  type: python
type: action

get_function_concurrency

Type probe
Module chaosaws.awslambda.probes
Name get_function_concurrency
Return boolean

Get configuration information of lambda by its function name

Signature:

def get_function_concurrency(
        function_name: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
function_name string Yes

Usage:

{
  "name": "get-function-concurrency",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "get_function_concurrency",
    "arguments": {
      "function_name": ""
    },
    "module": "chaosaws.awslambda.probes"
  }
}
name: get-function-concurrency
provider:
  arguments:
    function_name: ''
  func: get_function_concurrency
  module: chaosaws.awslambda.probes
  type: python
type: probe

get_function_memory_size

Type probe
Module chaosaws.awslambda.probes
Name get_function_memory_size
Return integer

Get the configured memory size of a lambda function.

The returned memory size is specified in megabytes.

Signature:

def get_function_memory_size(function_name: str,
                             qualifier: str = None,
                             configuration: Dict[str, Dict[str, str]] = None,
                             secrets: Dict[str, Dict[str, str]] = None) -> int:
    pass

Arguments:

Name Type Default Required
function_name string Yes
qualifier string null No

Usage:

{
  "name": "get-function-memory-size",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "get_function_memory_size",
    "arguments": {
      "function_name": ""
    },
    "module": "chaosaws.awslambda.probes"
  }
}
name: get-function-memory-size
provider:
  arguments:
    function_name: ''
  func: get_function_memory_size
  module: chaosaws.awslambda.probes
  type: python
type: probe

get_function_timeout

Type probe
Module chaosaws.awslambda.probes
Name get_function_timeout
Return integer

Get the configured timeout of a lambda function.

The returned timeout is specified in number of seconds.

Signature:

def get_function_timeout(function_name: str,
                         qualifier: str = None,
                         configuration: Dict[str, Dict[str, str]] = None,
                         secrets: Dict[str, Dict[str, str]] = None) -> int:
    pass

Arguments:

Name Type Default Required
function_name string Yes
qualifier string null No

Usage:

{
  "name": "get-function-timeout",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "get_function_timeout",
    "arguments": {
      "function_name": ""
    },
    "module": "chaosaws.awslambda.probes"
  }
}
name: get-function-timeout
provider:
  arguments:
    function_name: ''
  func: get_function_timeout
  module: chaosaws.awslambda.probes
  type: python
type: probe

invoke_function

Type action
Module chaosaws.awslambda.actions
Name invoke_function
Return mapping

Invokes Lambda.

More information about request arguments are available in the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/lambda.html#Lambda.Client.invoke

Signature:

def invoke_function(
        function_name: str,
        function_arguments: Dict[str, Any] = None,
        invocation_type: str = 'RequestResponse',
        client_context: Dict[str, Any] = None,
        qualifier: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
function_name string Yes
function_arguments mapping null No
invocation_type string “RequestResponse” No
client_context mapping null No
qualifier string null No

Usage:

{
  "name": "invoke-function",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "invoke_function",
    "arguments": {
      "function_name": ""
    },
    "module": "chaosaws.awslambda.actions"
  }
}
name: invoke-function
provider:
  arguments:
    function_name: ''
  func: invoke_function
  module: chaosaws.awslambda.actions
  type: python
type: action

put_function_concurrency

Type action
Module chaosaws.awslambda.actions
Name put_function_concurrency
Return mapping

Throttles Lambda by setting reserved concurrency amount.

Signature:

def put_function_concurrency(
        function_name: str,
        concurrent_executions: int,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
function_name string Yes
concurrent_executions integer Yes

Usage:

{
  "name": "put-function-concurrency",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "put_function_concurrency",
    "arguments": {
      "function_name": "",
      "concurrent_executions": 0
    },
    "module": "chaosaws.awslambda.actions"
  }
}
name: put-function-concurrency
provider:
  arguments:
    concurrent_executions: 0
    function_name: ''
  func: put_function_concurrency
  module: chaosaws.awslambda.actions
  type: python
type: action

put_function_memory_size

Type action
Module chaosaws.awslambda.actions
Name put_function_memory_size
Return mapping

Sets the function memory size.

Input memory_size argument is specified in megabytes.

Signature:

def put_function_memory_size(
        function_name: str,
        memory_size: int,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
function_name string Yes
memory_size integer Yes

Usage:

{
  "name": "put-function-memory-size",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "put_function_memory_size",
    "arguments": {
      "memory_size": 0,
      "function_name": ""
    },
    "module": "chaosaws.awslambda.actions"
  }
}
name: put-function-memory-size
provider:
  arguments:
    function_name: ''
    memory_size: 0
  func: put_function_memory_size
  module: chaosaws.awslambda.actions
  type: python
type: action

put_function_timeout

Type action
Module chaosaws.awslambda.actions
Name put_function_timeout
Return mapping

Sets the function timeout.

Input timeout argument is specified in seconds.

Signature:

def put_function_timeout(
        function_name: str,
        timeout: int,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
function_name string Yes
timeout integer Yes

Usage:

{
  "name": "put-function-timeout",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "put_function_timeout",
    "arguments": {
      "timeout": 0,
      "function_name": ""
    },
    "module": "chaosaws.awslambda.actions"
  }
}
name: put-function-timeout
provider:
  arguments:
    function_name: ''
    timeout: 0
  func: put_function_timeout
  module: chaosaws.awslambda.actions
  type: python
type: action

ec2


attach_volume

Type action
Module chaosaws.ec2.actions
Name attach_volume
Return list

Attaches a previously detached EBS volume to its associated EC2 instance.

If neither ‘instance_ids’ or ‘filters’ are provided, all detached volumes will be reattached to their respective instances

Parameters: One of: instance_ids: list: instance ids filters: list: key/value pairs to pull ec2 instances

Signature:

def attach_volume(
        instance_ids: List[str] = None,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_ids list null No
filters list null No

Usage:

{
  "name": "attach-volume",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "attach_volume",
    "module": "chaosaws.ec2.actions"
  }
}
name: attach-volume
provider:
  func: attach_volume
  module: chaosaws.ec2.actions
  type: python
type: action

count_instances

Type probe
Module chaosaws.ec2.probes
Name count_instances
Return integer

Return count of instances matching the specified filters.

Please refer to https://bit.ly/2Sv9lmU

for details on said filters.

Signature:

def count_instances(filters: List[Dict[str, Any]],
                    configuration: Dict[str, Dict[str, str]] = None,
                    secrets: Dict[str, Dict[str, str]] = None) -> int:
    pass

Arguments:

Name Type Default Required
filters list Yes

Usage:

{
  "name": "count-instances",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "count_instances",
    "arguments": {
      "filters": []
    },
    "module": "chaosaws.ec2.probes"
  }
}
name: count-instances
provider:
  arguments:
    filters: []
  func: count_instances
  module: chaosaws.ec2.probes
  type: python
type: probe

describe_instances

Type probe
Module chaosaws.ec2.probes
Name describe_instances
Return mapping

Describe instances following the specified filters.

Please refer to https://bit.ly/2Sv9lmU

for details on said filters.

Signature:

def describe_instances(
        filters: List[Dict[str, Any]],
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
filters list Yes

Usage:

{
  "name": "describe-instances",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "describe_instances",
    "arguments": {
      "filters": []
    },
    "module": "chaosaws.ec2.probes"
  }
}
name: describe-instances
provider:
  arguments:
    filters: []
  func: describe_instances
  module: chaosaws.ec2.probes
  type: python
type: probe

detach_random_volume

Type action
Module chaosaws.ec2.actions
Name detach_random_volume
Return list

Detaches a random ebs volume (non root) from one or more EC2 instances

Parameters: One of: instance_ids: a list of one or more ec2 instance ids filters: a list of key/value pairs to pull ec2 instances

force: force detach volume (default: true)

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def detach_random_volume(
        instance_ids: List[str] = None,
        filters: List[Dict[str, Any]] = None,
        force: bool = True,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_ids list null No
filters list null No
force boolean true No

Usage:

{
  "name": "detach-random-volume",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "detach_random_volume",
    "module": "chaosaws.ec2.actions"
  }
}
name: detach-random-volume
provider:
  func: detach_random_volume
  module: chaosaws.ec2.actions
  type: python
type: action

instance_state

Type probe
Module chaosaws.ec2.probes
Name instance_state
Return boolean

Determines if EC2 instances match desired state

For additional filter options, please refer to the documentation found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def instance_state(state: str,
                   instance_ids: List[str] = None,
                   filters: List[Dict[str, Any]] = None,
                   configuration: Dict[str, Dict[str, str]] = None,
                   secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
state string Yes
instance_ids list null No
filters list null No

Usage:

{
  "name": "instance-state",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "instance_state",
    "arguments": {
      "state": ""
    },
    "module": "chaosaws.ec2.probes"
  }
}
name: instance-state
provider:
  arguments:
    state: ''
  func: instance_state
  module: chaosaws.ec2.probes
  type: python
type: probe

restart_instances

Type action
Module chaosaws.ec2.actions
Name restart_instances
Return list

Restarts one or more EC2 instances.

WARNING: If only an Availability Zone is provided, all instances in the provided AZ will be restarted.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def restart_instances(
        instance_ids: List[str] = None,
        az: str = None,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_ids list null No
az string null No
filters list null No

Usage:

{
  "name": "restart-instances",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "restart_instances",
    "module": "chaosaws.ec2.actions"
  }
}
name: restart-instances
provider:
  func: restart_instances
  module: chaosaws.ec2.actions
  type: python
type: action

start_instances

Type action
Module chaosaws.ec2.actions
Name start_instances
Return list

Starts one or more EC2 instances.

WARNING: If only an Availability Zone is provided, all instances in the provided AZ will be started.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def start_instances(
        instance_ids: List[str] = None,
        az: str = None,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_ids list null No
az string null No
filters list null No

Usage:

{
  "name": "start-instances",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "start_instances",
    "module": "chaosaws.ec2.actions"
  }
}
name: start-instances
provider:
  func: start_instances
  module: chaosaws.ec2.actions
  type: python
type: action

stop_instance

Type action
Module chaosaws.ec2.actions
Name stop_instance
Return list

Stop a single EC2 instance.

You may provide an instance id explicitly or, if you only specify the AZ, a random instance will be selected. If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def stop_instance(
        instance_id: str = None,
        az: str = None,
        force: bool = False,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_id string null No
az string null No
force boolean false No
filters list null No

Usage:

{
  "name": "stop-instance",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "stop_instance",
    "module": "chaosaws.ec2.actions"
  }
}
name: stop-instance
provider:
  func: stop_instance
  module: chaosaws.ec2.actions
  type: python
type: action

stop_instances

Type action
Module chaosaws.ec2.actions
Name stop_instances
Return list

Stop the given EC2 instances or, if none is provided, all instances of the given availability zone. If you need more control, you can also provide a list of filters following the documentation https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def stop_instances(
        instance_ids: List[str] = None,
        az: str = None,
        filters: List[Dict[str, Any]] = None,
        force: bool = False,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_ids list null No
az string null No
filters list null No
force boolean false No

Usage:

{
  "name": "stop-instances",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "stop_instances",
    "module": "chaosaws.ec2.actions"
  }
}
name: stop-instances
provider:
  func: stop_instances
  module: chaosaws.ec2.actions
  type: python
type: action

terminate_instance

Type action
Module chaosaws.ec2.actions
Name terminate_instance
Return list

Terminates a single EC2 instance.

An instance may be targeted by specifying it by instance-id. If only the availability-zone is provided, a random instances in that AZ will be selected and terminated. For more control, please reference the available filters found: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def terminate_instance(
        instance_id: str = None,
        az: str = None,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_id string null No
az string null No
filters list null No

Usage:

{
  "name": "terminate-instance",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "terminate_instance",
    "module": "chaosaws.ec2.actions"
  }
}
name: terminate-instance
provider:
  func: terminate_instance
  module: chaosaws.ec2.actions
  type: python
type: action

terminate_instances

Type action
Module chaosaws.ec2.actions
Name terminate_instances
Return list

Terminates multiple EC2 instances

A set of instances may be targeted by providing them as the instance-ids.

WARNING: If only an Availability Zone is specified, all instances in that AZ will be terminated.

Additional filters may be used to narrow the scope: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ec2.html#EC2.Client.describe_instances

Signature:

def terminate_instances(
        instance_ids: List[str] = None,
        az: str = None,
        filters: List[Dict[str, Any]] = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> List[Dict[str, Any]]:
    pass

Arguments:

Name Type Default Required
instance_ids list null No
az string null No
filters list null No

Usage:

{
  "name": "terminate-instances",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "terminate_instances",
    "module": "chaosaws.ec2.actions"
  }
}
name: terminate-instances
provider:
  func: terminate_instances
  module: chaosaws.ec2.actions
  type: python
type: action

iam


attach_role_policy

Type action
Module chaosaws.iam.actions
Name attach_role_policy
Return mapping

Attach a role to a policy.

Signature:

def attach_role_policy(
        arn: str,
        role_name: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
arn string Yes
role_name string Yes

Usage:

{
  "name": "attach-role-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "attach_role_policy",
    "arguments": {
      "role_name": "",
      "arn": ""
    },
    "module": "chaosaws.iam.actions"
  }
}
name: attach-role-policy
provider:
  arguments:
    arn: ''
    role_name: ''
  func: attach_role_policy
  module: chaosaws.iam.actions
  type: python
type: action

create_policy

Type action
Module chaosaws.iam.actions
Name create_policy
Return mapping

Create a new IAM policy

Signature:

def create_policy(name: str,
                  policy: Dict[str, Any],
                  path: str = '/',
                  description: str = '',
                  configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
policy mapping Yes
path string ”/” No
description string ”“ No

Usage:

{
  "name": "create-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "create_policy",
    "arguments": {
      "name": "",
      "policy": {}
    },
    "module": "chaosaws.iam.actions"
  }
}
name: create-policy
provider:
  arguments:
    name: ''
    policy: {}
  func: create_policy
  module: chaosaws.iam.actions
  type: python
type: action

detach_role_policy

Type action
Module chaosaws.iam.actions
Name detach_role_policy
Return mapping

Detach a role from a policy.

Signature:

def detach_role_policy(
        arn: str,
        role_name: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
arn string Yes
role_name string Yes

Usage:

{
  "name": "detach-role-policy",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "detach_role_policy",
    "arguments": {
      "role_name": "",
      "arn": ""
    },
    "module": "chaosaws.iam.actions"
  }
}
name: detach-role-policy
provider:
  arguments:
    arn: ''
    role_name: ''
  func: detach_role_policy
  module: chaosaws.iam.actions
  type: python
type: action

get_policy

Type probe
Module chaosaws.iam.probes
Name get_policy
Return boolean

Get a policy by its ARN

Signature:

def get_policy(arn: str,
               configuration: Dict[str, Dict[str, str]] = None,
               secrets: Dict[str, Dict[str, str]] = None) -> bool:
    pass

Arguments:

Name Type Default Required
arn string Yes

Usage:

{
  "name": "get-policy",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "get_policy",
    "arguments": {
      "arn": ""
    },
    "module": "chaosaws.iam.probes"
  }
}
name: get-policy
provider:
  arguments:
    arn: ''
  func: get_policy
  module: chaosaws.iam.probes
  type: python
type: probe

eks


create_cluster

Type action
Module chaosaws.eks.actions
Name create_cluster
Return mapping

Create a new EKS cluster.

Signature:

def create_cluster(
        name: str,
        role_arn: str,
        vpc_config: Dict[str, Any],
        version: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes
role_arn string Yes
vpc_config mapping Yes
version string null No

Usage:

{
  "name": "create-cluster",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "create_cluster",
    "arguments": {
      "name": "",
      "vpc_config": {},
      "role_arn": ""
    },
    "module": "chaosaws.eks.actions"
  }
}
name: create-cluster
provider:
  arguments:
    name: ''
    role_arn: ''
    vpc_config: {}
  func: create_cluster
  module: chaosaws.eks.actions
  type: python
type: action

delete_cluster

Type action
Module chaosaws.eks.actions
Name delete_cluster
Return mapping

Delete the given EKS cluster.

Signature:

def delete_cluster(
        name: str = None,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string null No

Usage:

{
  "name": "delete-cluster",
  "type": "action",
  "provider": {
    "type": "python",
    "func": "delete_cluster",
    "module": "chaosaws.eks.actions"
  }
}
name: delete-cluster
provider:
  func: delete_cluster
  module: chaosaws.eks.actions
  type: python
type: action

describe_cluster

Type probe
Module chaosaws.eks.probes
Name describe_cluster
Return mapping

Describe an EKS cluster.

Signature:

def describe_cluster(
        name: str,
        configuration: Dict[str, Dict[str, str]] = None,
        secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required
name string Yes

Usage:

{
  "name": "describe-cluster",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "describe_cluster",
    "arguments": {
      "name": ""
    },
    "module": "chaosaws.eks.probes"
  }
}
name: describe-cluster
provider:
  arguments:
    name: ''
  func: describe_cluster
  module: chaosaws.eks.probes
  type: python
type: probe

list_clusters

Type probe
Module chaosaws.eks.probes
Name list_clusters
Return mapping

List EKS clusters available to the authenticated account.

Signature:

def list_clusters(configuration: Dict[str, Dict[str, str]] = None,
                  secrets: Dict[str, Dict[str, str]] = None) -> Dict[str, Any]:
    pass

Arguments:

Name Type Default Required

Usage:

{
  "name": "list-clusters",
  "type": "probe",
  "provider": {
    "type": "python",
    "func": "list_clusters",
    "module": "chaosaws.eks.probes"
  }
}
name: list-clusters
provider:
  func: list_clusters
  module: chaosaws.eks.probes
  type: python
type: probe