5: Incident and Event Response

    Troubleshoot Issues and Determine How to Restore Operations

    Incident response on AWS starts the moment a signal becomes actionable: a CloudWatch alarm transitions to ALARM, an AWS Health event arrives on the default EventBridge bus, an AWS Config rule reports NON_COMPLIANT, or a synthetic canary fails an assertion. The DevOps engineer who picks up that signal owns the rest of the loop, from triage to restoration to post-incident closure. The exam tests this end-to-end loop, and it tests whether you can pick the correct restoration path under pressure: rollback to the previous deployment, redeploy a known-good artifact, or restore from backup. Each path has a different blast radius, a different time to recovery, and a different risk of secondary damage. Pick the wrong one and the outage doubles in length.

    The triage phase compresses three questions into a few minutes. What broke? When did it break? Who or what changed last? The first question maps to CloudWatch metrics and logs, X-Ray traces, and (for ECS/EKS workloads) Container Insights. The second question maps to alarm transition timestamps, the eventTime field in CloudTrail, and AWS Config configuration-history entries. The third question maps to CloudTrail management events filtered to the IAM principal and the affected resource, plus CodePipeline execution history if the change came through a delivery pipeline. The output of triage is a hypothesis: a specific change at a specific time by a specific actor on a specific resource. Restoration steps follow from that hypothesis.

    Rollback is the default restoration path for a bad deployment. In CodeDeploy, an automatic rollback configuration reverts traffic when a CloudWatch alarm fires during the BlueGreen or in-place deployment, or when the deployment fails outright. For an EC2 in-place deployment, rollback re-deploys the previous successful revision; for blue/green it shifts traffic back to the previous fleet. For an ECS blue/green deployment, the previous task set remains warm until the wait time elapses, so rollback is instant. For a Lambda canary or linear shift, the alias RoutingConfig reverts to the previous version when an alarm fires. Rollback is the right answer when the failure correlates one-to-one with a deployment and there are no schema or data changes that would block reverting code.

    Redeploy is the right path when configuration drift, not the deployment artifact itself, caused the issue. A common case is an operator-applied parameter change in Systems Manager Parameter Store that broke a downstream Lambda, or an AWS Config rule that auto-remediated a security group and disconnected a workload. Redeploying the IaC template through CloudFormation with a change set forces a known-good configuration back onto the affected stack. The redeploy path is not the same as rollback: it pushes the current declared state, not a previous artifact version.

    Restore-from-backup is the path of last resort because it is the slowest and most disruptive. It is the right path when data has been corrupted or destructively modified: an accidental DROP TABLE, a misconfigured replication that propagated bad data, or a ransomware-like event that re-encrypted files in Amazon S3. AWS Backup handles cross-service restore through restore jobs, AWS Backup Vault Lock prevents the backup itself from being tampered with, and point-in-time recovery in Amazon RDS, Amazon DynamoDB, and Amazon S3 (with versioning plus delete-marker reversal) recovers state without restoring the whole resource. The trap on the exam is to pick restore-from-backup for a bad deployment: the deployment failure is a code problem, not a data problem, and the rollback path is faster.

    Configure AWS Chatbot integrations with messaging platforms

    AWS Chatbot is the engagement surface inside the messaging platform where on-call teams already live. It integrates Amazon SNS topics with Slack channels, Microsoft Teams channels, and Amazon Chime webhooks, so that an alarm or EventBridge event arrives in chat as a formatted card rather than as raw JSON in a webhook. Beyond passive notification, AWS Chatbot supports running approved AWS CLI commands directly from chat, scoped by an IAM role that AWS Chatbot assumes on behalf of the channel. This ChatBot guardrail policy plus a ChannelRole shapes the blast radius: the channel role lists the permissions that any user in the channel can use; the guardrail policy lists the permissions that the role can ever grant. The two intersect at the actual permission set.

    The integration is wired through a Slack workspace or Microsoft Teams team that has been authorized to AWS Chatbot at the AWS Organizations level, then a Slack channel or Teams channel is bound to a Chatbot configuration, then SNS topics are added as notification sources. EventBridge events targeting an SNS topic flow through Chatbot to chat. Alarms publish to the same SNS topic and arrive as alarm cards with the metric chart and state-change reason. CloudWatch dashboard widgets and Logs Insights queries can be requested from chat through @aws commands, and Systems Manager Automation runbooks can be invoked from chat too, subject to the channel role's permissions.

    # Create the IAM role that AWS Chatbot will assume for a Slack channel
    aws iam create-role \
     --role-name ChatbotIncidentChannelRole \
     --assume-role-policy-document '{
     "Version": "2012-10-17",
     "Statement": [{
     "Effect": "Allow",
     "Principal": {"Service": "chatbot.amazonaws.com"},
     "Action": "sts:AssumeRole"
     }]
     }'
    
    # Attach a permissive read-only policy plus a narrow remediation policy
    aws iam attach-role-policy \
     --role-name ChatbotIncidentChannelRole \
     --policy-arn arn:aws:iam::aws:policy/AWSChatbotChannelConfigurationReadOnlyAccess
    
    aws iam attach-role-policy \
     --role-name ChatbotIncidentChannelRole \
     --policy-arn arn:aws:iam::111122223333:policy/IncidentChannelRemediation
    
    # Create a Chatbot configuration that binds the channel to the role and SNS topic
    aws chatbot create-slack-channel-configuration \
     --configuration-name "prod-incident-room" \
     --iam-role-arn arn:aws:iam::111122223333:role/ChatbotIncidentChannelRole \
     --slack-team-id "T0123456789" \
     --slack-channel-id "C0987654321" \
     --sns-topic-arns "arn:aws:sns:us-east-1:111122223333:incident-events" \
     --guardrail-policies "arn:aws:iam::aws:policy/ReadOnlyAccess"
    

    The guardrail policy is the maximum permission boundary for any Chatbot command issued in this channel. Even if IncidentChannelRemediation allows ssm:StartAutomationExecution, the guardrail (here, ReadOnlyAccess) clips the effective permissions to the intersection. For channels that need to run remediation, the guardrail must include the remediation actions. A common production pattern is two channels per environment: a read-only channel for triage with ReadOnlyAccess as the guardrail, and a break-glass channel for runbook execution with a narrower guardrail listing exactly the runbooks allowed.

    # CloudFormation snippet: Chatbot SlackChannelConfiguration with logging
    Resources:
     IncidentChannel:
     Type: AWS::Chatbot::SlackChannelConfiguration
     Properties:
     ConfigurationName: prod-incident-room
     IamRoleArn: !GetAtt ChatbotIncidentChannelRole.Arn
     SlackWorkspaceId: T0123456789
     SlackChannelId: C0987654321
     SnsTopicArns:
     - !Ref IncidentEventsTopic
     LoggingLevel: INFO
     GuardrailPolicies:
     - arn:aws:iam::aws:policy/ReadOnlyAccess
     UserRoleRequired: false
    

    LoggingLevel: INFO ships every command, response, and notification to CloudWatch Logs in the AWS Chatbot service log group. For audit purposes this log is the record of who ran which command from chat, since every chat user is mapped to the IAM role at the channel boundary. The UserRoleRequired flag, when set to true, forces each chat user to map their personal IAM role through AWS IAM Identity Center; this is the right setting for high-privilege channels where per-user audit matters.

    💡 Exam Trap: AWS Chatbot does not authenticate individual users in a Slack channel by default. Every command runs as the channel's ChannelRole, clipped by the Guardrail policies. If the exam asks about per-user attribution for emergency changes, the correct answer is to enable UserRoleRequired and map users through IAM Identity Center, not to add usernames to a policy condition.

    💡 Exam Trap: When a deployment failure correlates one-to-one with a CodeDeploy execution, the answer is rollback, not restore-from-backup. Restore-from-backup is the answer for data corruption or destructive change, not for a bad code revision. The keyword to watch is whether the question describes a data integrity problem (rows are wrong, files are encrypted) or a code/configuration problem (the new revision returns 500s).

    ⚠️ Anti-Pattern: Granting an AWS Chatbot channel role full AdministratorAccess so that operators "can fix anything from chat." The channel is shared, the role is shared, and an attacker who phishes one operator's Slack account inherits administrator on the whole AWS account. Always scope the channel role to a narrow remediation policy, set a guardrail policy as the upper bound, and reserve account-administrator actions for break-glass IAM principals with MFA.

    🎯 Scenario: A nightly release deployed at 03:00 begins returning 502 errors at 03:08 from the production ALB. Triage shows that a new CodeDeploy revision changed the Lambda handler to import a module that is not in the deployment package. The on-call engineer types @aws codedeploy stop-deployment --deployment-id d-1234ABCD --auto-rollback-enabled from the incident Slack channel. AWS Chatbot, scoped by the channel role, invokes StopDeployment with auto-rollback. CodeDeploy reverts traffic to the previous Lambda alias version. The alarm clears within four minutes of detection. Restore-from-backup was never the right answer; the data plane was healthy throughout.

    Decision Anchor: Choose rollback when the failure correlates with a deployment and the data plane is healthy. Choose redeploy when configuration drift, not the artifact, caused the issue. Choose restore-from-backup only when data has been corrupted or destructively modified and no in-place fix is possible.


    Continue with the interactive course

    Track your progress, jump into practice questions and use the Shark AI tutor inside the AWS - DevOps Engineer Professional learning hub.