Skip to main content

SSM chaos by ID

AWS SSM chaos by ID induces chaos on AWS EC2 instances using the Amazon SSM Run Command.

  • It is executed using the SSM document that defines the actions which the systems manager can perform on your managed instances (that have SSM agent installed).
  • This SSM document is uploaded beforehand to AWS, whose name is referenced as an input to the chaos faults.
  • It helps execute custom chaos (like stress, network, disk or IO) on AWS EC2 instances for a specific duration using the given instance ID(s).

SSM chaos by ID

Use cases

AWS SSM chaos by ID:

  • Tests the resilience of EC2 instance or services in that instance by using custom SSM document as input to execute chaos on it.
  • Triggers and manages the SSM command executed via SSM docs that is an input to the experiment.


  • Kubernetes >= 1.17
  • The SSM document should be available in AWS.
  • Authentication is done using IRSA or secret. For secret-based authentication, create a Kubernetes secret that has the AWS access configuration(key) in the CHAOS_NAMESPACE. Below is a sample secret file:
apiVersion: v1
kind: Secret
name: cloud-secret
type: Opaque
cloud_config.yml: |-
# Add the cloud AWS credentials respectively
aws_access_key_id = XXXXXXXXXXXXXXXXXXX
aws_secret_access_key = XXXXXXXXXXXXXXX

HCE recommends that you use the same secret name, that is, cloud-secret. Otherwise, you will need to update the AWS_SHARED_CREDENTIALS_FILE environment variable in the fault template with the new secret name and you won't be able to use the default health check probes.

Below is an example AWS policy to execute the fault.

"Version": "2012-10-17",
"Statement": [
"Effect": "Allow",
"Action": [
"Resource": "*"
"Effect": "Allow",
"Action": [
"Resource": "*"

Mandatory tunables

Tunable Description Notes
EC2_INSTANCE_ID Instance ID of the target EC2 instance. Multiple IDs can also be provided as a comma(,) separated values. Multiple IDs can be provided as "id1,id2". For more information, go to EC2 instance ID.
REGION Region name of the target ECS cluster For example, us-east-1.

Optional tunables

Tunable Description Notes
TOTAL_CHAOS_DURATION Duration that you specify, through which chaos is injected into the target resource (in seconds). Default: 30s. For more information, go to duration of the chaos.
CHAOS_INTERVAL Interval between successive instance terminations (in seconds). Default: 30s. For more information, go to chaos interval.
AWS_SHARED_CREDENTIALS_FILE Path to the AWS secret credentials. Defaults to /tmp/cloud_config.yml.
DOCUMENT_NAME Name of the SSM docs that is added to AWS. Create or upload this document to AWS before providing the document as an input to any AWS chaos fault.
PLUGIN_NAMES Specific plugin used in an SSM document (or command), such as runShellScript or ExecuteStressNg, which defines the action to be executed on the target instances. You can provide multiple names as comma-separated values.
SEQUENCE It defines a sequence of chaos execution for multiple instances. Default: parallel. Supports serial and parallel. For more information, go to sequence of chaos execution.
RAMP_TIME Period to wait before and after injecting chaos (in seconds). For example, 30 s. For more information, go to ramp time.

SSM chaos by ID

Comma-separated list of target instance IDs. Tune it by using the EC2_INSTANCE_ID environment variable.

The following YAML snippet illustrates the use of this environment variable:

# contains the instance id, to be terminated/stopped
kind: ChaosEngine
name: engine-nginx
engineState: "active"
chaosServiceAccount: litmus-admin
- name: ssm-chaos-by-id
# ID of the EC2 instance
value: 'instance-1'
# region for the EC2 instance
- name: REGION
value: 'us-east-1'