Incident Response · Topic 2 of 5
Automated Response and Remediation
Build automated security response with EventBridge, Systems Manager Automation, Lambda, Step Functions and Config remediation, and set safe limits.
- 5 min
- Includes a diagram
- EventBridge is the trigger layer, and Systems Manager Automation, Lambda and Step Functions are the action layer.
- Config rules plus remediation actions fix configuration drift, and remediation runs an SSM Automation document.
- Automation needs two permissions: one for the caller to start it and one execution role for the runbook itself.
What it is
Automated response means that a detection triggers a containment or fix without waiting for a person. It shortens the time an attacker has, and it removes inconsistent manual steps.
Not every action should be automatic. The skill the exam tests is choosing which actions are safe to automate, and which service runs them.
How it works
The building blocks
| Tool | Best for |
|---|---|
| EventBridge rule | Matching a finding or API event and starting a target |
| Systems Manager Automation | Repeatable runbooks for AWS actions, with approvals and rate controls |
| AWS Lambda | Short custom logic, such as tagging, enriching or calling an external API |
| AWS Step Functions | Multi step workflows with branching, retries and human approval |
| AWS Config remediation | Fixing a resource that becomes non compliant |
| Security Hub custom action | A person selects findings and starts a response on demand |
Choose Automation documents for standard AWS operations, because AWS provides many ready runbooks. Choose Lambda when you need code, and Step Functions when you need a workflow that spans minutes or waits for a person.
Event driven response
An EventBridge rule on a high severity GuardDuty finding can start an Automation runbook that isolates the instance.
{
"source": ["aws.guardduty"],
"detail-type": ["GuardDuty Finding"],
"detail": {
"type": [{ "prefix": "UnauthorizedAccess:EC2/" }],
"severity": [{ "numeric": [">=", 7] }]
}
}
The target is an SSM Automation document, and the rule needs an IAM role that is allowed to start the automation. The automation itself uses a separate execution role with only the permissions it needs, such as changing a security group and creating a snapshot.
Config remediation
AWS Config evaluates resources against rules, and a remediation action can run an Automation document on each non compliant resource.
# AWS CLI: remediate public S3 buckets automatically
aws configservice put-remediation-configurations --remediation-configurations '[{
"ConfigRuleName": "s3-bucket-public-read-prohibited",
"TargetType": "SSM_DOCUMENT",
"TargetId": "AWS-DisableS3BucketPublicReadWrite",
"Automatic": true,
"MaximumAutomaticAttempts": 3,
"RetryAttemptSeconds": 60,
"Parameters": {
"AutomationAssumeRole": { "StaticValue": { "Values": ["arn:aws:iam::111122223333:role/ConfigRemediationRole"] } },
"S3BucketName": { "ResourceValue": { "Value": "RESOURCE_ID" } }
}
}]'
Remediation can be manual, where a person approves it, or automatic. Config also limits retries with MaximumAutomaticAttempts, which prevents endless loops on a fault.
Multi account response
In an organization, run the detection and the rule centrally and act in member accounts by assuming a response role. A common pattern forwards events to a central bus, then a Lambda function or Automation assumes a pre created role in the affected account. The role trusts only the central automation role.
Safe automation design
- Least privilege. Give each runbook its own role limited to its actions.
- Reversible first. Prefer isolating, tagging and snapshotting over terminating or deleting.
- Preserve evidence. Take a snapshot before any destructive step.
- Loop control. Make sure the fix does not trigger the rule again, for example by filtering on a tag that the runbook sets.
- Human approval for high impact actions, using an Automation approval step or Step Functions.
- Notify and log. Every automated action should notify the team, and runs are recorded in CloudTrail.
- Test in a non production account using sample findings.
Typical scenarios
| Event | Automated first response |
|---|---|
| Instance credential exfiltration finding | Attach a deny policy to the role and isolate the instance |
| Public S3 bucket | Enable Block Public Access, notify the owner |
| Security group opened to the world on SSH | Revert the rule and tag the group |
| Root account use | Alert at once, no auto fix, human investigates |
| Unapproved IAM user created | Disable the user and notify |
What to remember for the exam
- EventBridge is the trigger layer, and Systems Manager Automation, Lambda and Step Functions are the action layer.
- Config rules plus remediation actions fix configuration drift, and remediation runs an SSM Automation document.
- Automation needs two permissions: one for the caller to start it and one execution role for the runbook itself.
- Step Functions suits workflows with branches and human approval. Lambda suits short custom code.
- Cross account response uses a central trigger and a pre created role in each member account.
- Prefer reversible containment, and snapshot before you terminate.
- Cap retries on remediation to avoid loops.
- Security Hub custom actions let analysts choose when to start a response.
"Remediate automatically when a resource becomes non compliant" points to an AWS Config rule with an automatic remediation action. "Respond to a threat finding" points to EventBridge with a runbook.
Common mistakes
Giving the runbook administrator rights. If the automation is hijacked, so are your accounts.
Terminating the instance first. Memory and disk evidence is lost, so isolate and snapshot instead.
Automating everything. Actions that can cause outages, such as stopping a production database, need human approval.
Ignoring loops. A remediation that changes a resource can raise the same finding again and re-run forever.
An auto remediation that blocks all traffic for a false positive can cause an outage, so scope the trigger to high confidence findings and keep a manual undo.
Check yourself
Which service fixes a resource automatically when a Config rule reports it as non compliant?
Config remediation, which runs a Systems Manager Automation document on the resource.
When do you choose Step Functions over Lambda for a response?
When the workflow has several steps, branches or a wait for human approval.
Why snapshot before terminating a compromised instance?
The snapshot preserves disk evidence that termination would otherwise destroy.
Topic 2 of 5 in Incident Response
Test yourself on Incident Response
The full AWS SCS-C03 question bank has 858 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by AWS. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.