Your System Passed Every Test. But Have You Tested Its Failure?
Most AWS applications are tested under ideal conditions. APIs respond, databases remain available, and queues process messages as expected. But production rarely behaves like a test environment. AWS Fault Injection Service (AWS FIS) enables developers to deliberately introduce controlled disruptions and observe how applications respond. This article explores how chaos engineering can reveal hidden architectural weaknesses before customers discover them.
The Problem With Testing Only When Everything Works
Imagine deploying a backend application with the following architecture:
API Gateway | vLambda | vAmazon SQS | vWorker | vAmazon RDSYour integration tests pass.
Your deployment pipeline is green.
Your monitoring dashboard looks healthy.
Then Amazon SQS becomes temporarily inaccessible.
What happens next?
Does the producer retry indefinitely? Does the worker crash? Does the queue backlog grow until recovery becomes impossible? Does your application return errors to customers?
The uncomfortable truth is that a successful test doesn't necessarily mean a resilient application.
Traditional testing verifies expected behavior. Resilience testing verifies how your system behaves when expectations break.
This is where AWS Fault Injection Service becomes particularly interesting.
Meet AWS Fault Injection Service
AWS Fault Injection Service (AWS FIS) is a managed service for running controlled fault-injection experiments against AWS workloads.
It enables teams to simulate disruptions such as:
- EC2 instance termination or interruption
- Network connectivity disruption
- CPU stress
- Amazon EBS I/O interruptions
- Amazon ECS task failures
- Amazon RDS-related disruptions
Instead of waiting for a real incident, developers can intentionally introduce a failure and observe its effects.
The objective isn't to break production.
It's to discover weaknesses in a controlled environment before they become customer-facing incidents.
Think in Experiments, Not Random Failures
Chaos engineering isn't about randomly terminating resources.
A useful experiment begins with a hypothesis.
For example:
If our order-processing worker loses access to Amazon SQS for two minutes, the application should recover automatically without losing messages or creating duplicate orders.
Now we have something measurable.
The experiment can follow this structure:
Define Hypothesis | vSelect Target Resources | vInject Controlled Failure | vObserve CloudWatch Metrics | vValidate Recovery | vImprove ArchitectureAWS FIS uses experiment templates that define actions, targets, and stop conditions.
Targets can be selected using resource identifiers or criteria such as tags. Stop conditions can use Amazon CloudWatch alarms to halt an experiment when a specified threshold is reached.
This means an experiment can be designed with explicit boundaries instead of relying on someone to manually stop it at the right moment.
A Practical Example: What Happens When Your Worker Disappears?
Consider a background-processing system using Amazon SQS and Amazon ECS.
Normally:
API | vSQS Queue | vECS Workers | vDatabaseNow imagine an experiment that interrupts a worker task.
A healthy architecture should demonstrate several behaviors:
1. The queue absorbs the disruption.
Messages remain available for processing instead of disappearing simply because a worker is unavailable.
2. The system detects the problem.
CloudWatch metrics should reveal an increasing queue backlog or message age.
3. Capacity recovers.
ECS should replace interrupted tasks according to its service configuration, allowing processing to resume.
4. Duplicate processing is handled safely.
The application should use idempotent operations so that message redelivery doesn't create unintended side effects.
The experiment can reveal whether these mechanisms actually work together.
An architecture diagram may show automatic recovery. A fault-injection experiment provides evidence.
Observability Is Part of the Experiment
A failure that cannot be observed is difficult to learn from.
Before running an experiment, establish baseline metrics.
For an SQS-based workflow, useful measurements include:
-
ApproximateNumberOfMessagesVisible
-
ApproximateAgeOfOldestMessage
-
NumberOfMessagesSent
- Application error rate
- Processing latency
- Recovery time
Suppose your experiment interrupts a worker for three minutes.
You might define success as:
Hypothesis: Workers recover automatically.
Success criteria: No permanent message loss. Duplicate orders are prevented. Queue backlog returns to baseline. Application error rate remains acceptable.The specific thresholds depend on your workload.
The important part is defining success before injecting the failure.
Otherwise, it's easy to interpret any outcome as acceptable after the experiment finishes.
The Safety Principle: Failure Must Have Boundaries
AWS FIS performs real actions against real AWS resources.
This is not a simulated environment.
A poorly configured experiment can cause genuine disruption.
Start with a non-production environment, use narrowly scoped IAM permissions, target explicitly tagged resources, and configure CloudWatch stop conditions.
Review the permissions and rollback behavior of every action before running an experiment. Not every fault-injection action can be automatically reversed.
Never assume that stopping an experiment restores every resource to its previous state.
The Bigger Engineering Lesson
We often build systems around the assumption that dependencies will remain available.
But distributed systems are defined by their failures as much as by their successful interactions.
A queue becomes unavailable. A database experiences latency. A worker crashes. A network connection disappears.
The question isn't whether these events can happen.
The question is whether your application can handle them predictably.
AWS Fault Injection Service makes it possible to turn resilience from an architectural assumption into something measurable.
Instead of asking:
"Is our application resilient?"
You can ask:
"What happens when this specific dependency fails, and can we prove that our recovery mechanism works?"
The strongest cloud architectures aren't those that never experience failures. They're the ones whose failures are understood, contained, and recoverable.
And sometimes, the most valuable test you can run is the one where you deliberately make something go wrong.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article