Skip to content

Chaos Engineering

The Chaos view lets you inject faults into any AWS service emulated by CloudMock. This is useful for testing how your application handles slow responses, error codes, and rate limiting without modifying your application code.

CloudMock supports three types of fault injection:

TypeEffectValue
LatencyAdds artificial delay before respondingMilliseconds to add (e.g., 2000 for 2 seconds)
ErrorReturns an HTTP error status code instead of the real responseHTTP status code (e.g., 503 for Service Unavailable)
ThrottleRandomly fails a percentage of requests with a throttling errorPercentage of requests to fail (e.g., 50 for 50%)

Each chaos rule targets a specific service and optionally a specific action:

  • Service (required) — The AWS service name to target (e.g., s3, dynamodb, sqs). Use * to target all services.
  • Action (optional) — A specific API action to target (e.g., GetObject, PutItem). If omitted, the rule applies to all actions for that service.
  • Fault type — Latency, Error, or Throttle.
  • Value — The magnitude of the fault (milliseconds, status code, or percentage).
  1. Enter the service name in the Service field.
  2. Optionally enter an action name in the Action field.
  3. Select the fault type from the dropdown.
  4. Enter the value.
  5. Click Add (or press Enter).
  6. Toggle the Active switch to enable chaos injection.
  7. Click Apply Rules to send the configuration to CloudMock.

Rules are not active until you both toggle the Active switch on and click Apply Rules. This two-step process prevents accidental fault injection.

The Chaos view includes five built-in presets for common failure scenarios:

PresetEffect
Slow DatabaseDynamoDB + 2 second latency
Auth FailureCognito returns HTTP 403
Queue BacklogSQS + 5 second latency
Network PartitionAll services return HTTP 503
Lambda TimeoutLambda + 30 second latency

Click a preset to add its rules to the current rule list. You can combine multiple presets or mix presets with custom rules.

To prevent chaos rules from being left active accidentally, you can set a duration before applying:

DurationBehavior
IndefiniteRules stay active until manually disabled
1 minAuto-disable after 1 minute
5 minAuto-disable after 5 minutes
15 minAuto-disable after 15 minutes
30 minAuto-disable after 30 minutes
1 hourAuto-disable after 1 hour

When a duration is set, a countdown banner appears showing the remaining time. You can click Stop early to disable chaos before the timer expires.

When the timer reaches zero, the devtools automatically send a disable request to CloudMock, clearing all active rules.

You can manage chaos rules through the admin API without the devtools UI:

Terminal window
curl http://localhost:4599/api/chaos
Terminal window
curl -X POST http://localhost:4599/api/chaos \
-H "Content-Type: application/json" \
-d '{
"active": true,
"rules": [
{"service": "dynamodb", "type": "latency", "value": 2000},
{"service": "s3", "action": "GetObject", "type": "error", "value": 500}
]
}'
Terminal window
curl -X DELETE http://localhost:4599/api/chaos
Terminal window
curl -X PUT http://localhost:4599/api/chaos/RULE_ID \
-H "Content-Type: application/json" \
-d '{"service": "dynamodb", "type": "latency", "value": 5000}'
Terminal window
curl -X DELETE http://localhost:4599/api/chaos/RULE_ID
MethodPathDescription
GET/api/chaosList chaos rules and active status
POST/api/chaosCreate/update chaos rules (body: {active, rules})
DELETE/api/chaosDisable all chaos rules
PUT/api/chaos/{id}Update a single rule
DELETE/api/chaos/{id}Delete a single rule