2: Incident Response

    Workload Monitoring Strategy Across Application, Network, Infrastructure, and OS Layers

    A monitoring strategy must answer four questions for every workload: what attack would I miss if this layer went dark, who consumes the resulting telemetry, what retention the consumer needs, and what the encryption and access-control boundary around that telemetry looks like. The four layers (application, network, infrastructure, OS) each carry distinct threat models and distinct AWS sources. A workload that emits only CloudTrail without VPC Flow Logs cannot detect lateral movement; a workload that captures Flow Logs without OS-level process telemetry cannot reconstruct what code ran on the instance after a successful intrusion. The security architect designs the stack so that each layer's data feeds the same correlation engine (Amazon Security Lake, an OpenSearch cluster, or a SIEM via Kinesis Data Firehose) with a shared schema (OCSF where possible).

    The application layer covers structured logs emitted by the workload itself: HTTP request logs, application errors, authentication and authorization decisions, and business-logic events. For Lambda, these flow to CloudWatch Logs through the runtime's log group. For ECS and EKS tasks, the awslogs and awsfirelens drivers send container output to CloudWatch Logs or Firehose. For EC2-hosted services, the CloudWatch agent tails application log files and ships them. Application metrics carry the highest business signal: an unexpected spike in 401 responses, a drop in successful payments, or a surge in 5xx errors is often the first observable that a credential or downstream dependency has been compromised. Anomaly detection on these metrics catches threats that signature-based controls miss.

    The network layer covers traffic flow at multiple altitudes. VPC Flow Logs capture five-tuple plus action plus packet and byte counts at the ENI, subnet, or VPC level, with the option to deliver to CloudWatch Logs, S3, or a Kinesis Data Firehose, and to choose a custom log format that includes fields like flow direction, traffic path, TCP flags, and pkt-srcaddr (the real source when traffic passes through a load balancer or NAT). Transit Gateway flow logs capture inter-VPC and inter-account traffic at the attachment level. Route 53 Resolver query logs surface DNS lookups, which detect command-and-control beacons, DNS tunneling, and DGA-style domains that volumetric NetFlow misses. AWS WAF logs capture every evaluated request and the matching rule decision; these are the only source that explains why a particular request was blocked. ELB access logs and CloudFront access logs reconstruct the request path through public edges.

    The infrastructure layer covers control-plane and configuration telemetry. AWS CloudTrail management events record every API call against AWS service control planes, including the principal, source IP, user agent, request and response parameters, and the read-only flag. CloudTrail data events record S3 object-level operations, Lambda invocations, DynamoDB item-level operations, and other resource-data operations when explicitly enabled. CloudTrail Insights events surface unusual API call rates and error rates. AWS Config emits a configuration item for every change to every supported resource, and an aggregator centralizes these across accounts and Regions. Config rules express compliance criteria and emit non-compliance findings on every evaluation.

    The OS layer covers what runs inside the guest. The CloudWatch agent collects OS-level metrics (memory, disk, swap, processes) that EC2 hypervisor metrics cannot see, plus arbitrary log files (/var/log/secure, Windows Security Event Log, /var/log/audit/audit.log, application stdout). For containers, sidecar daemonsets or the runtime's logging driver play the same role. For EKS, control-plane audit logs (api, audit, authenticator, controllerManager, scheduler) flow to CloudWatch Logs when enabled on the cluster. Without these, kernel-level malicious activity (privilege escalation, suspicious syscalls, container escape) is invisible. GuardDuty Runtime Monitoring covers some of this gap for EKS, ECS, and EC2 using the optional security agent.

    Identifying logging requirements based on workload characteristics and business requirements

    Logging requirements derive from four inputs: regulatory obligations (PCI DSS 10.x, HIPAA, FedRAMP), the workload's data classification (public, internal, confidential, restricted), the incident-response runbook's evidence needs (which fields the responder will pivot on), and the business' acceptable cost ceiling. PCI DSS, for example, requires logging of every access to cardholder data, every privileged action, every authentication attempt (success and failure), and retention of those logs for one year with three months immediately available for analysis. A workload that processes cardholder data must enable CloudTrail data events on the relevant S3 buckets and DynamoDB tables, must enable S3 server access logging or S3 data events for redundancy, and must retain those logs in S3 with a Glacier transition that preserves immediate availability for the first 90 days. The architect captures these decisions in a logging matrix per workload.

    💡 Exam Trap: CloudTrail data events are NOT enabled by default. A trail with the default settings records management events only, which means S3 object reads and writes, Lambda invocations, and DynamoDB item operations are absent. PCI scenarios that ask "why did the auditor not see the S3 GetObject calls?" almost always answer to a missing data event selector on the trail.

    📊 Limit: A single account can have up to five trails per Region, and an organization trail counts as one of those five in every member account. The CloudTrail event history view retains 90 days of management events for free in every Region, regardless of trail configuration, but does not include data events.

    Identifying and remediating publicly exposed resources

    Public exposure of storage and snapshot resources is one of the most common breach root causes, and the exam tests both detection and remediation paths. Five resource types appear repeatedly: Amazon S3 buckets, EBS snapshots, AMIs, RDS snapshots, and Redshift clusters/snapshots. Each has a dedicated control plane for public exposure, and each has a Config managed rule plus a Security Hub finding and (in most cases) an IAM Access Analyzer external-access finding when shared cross-account or publicly.

    For S3, the layered controls are: account-level S3 Block Public Access (the BPA umbrella that overrides bucket-level grants), bucket-level BPA, bucket policies, ACLs (deprecated for new buckets but still present on legacy buckets), and Access Points. Macie and Access Analyzer for S3 find buckets that violate the intended privacy posture. The remediation is to turn on account-level BPA in every account by Organizations policy, set every bucket's Public and PublicAccessBlockConfiguration to true on all four flags, and use Service Control Policies to deny any principal from disabling BPA.

    # Enable S3 Block Public Access at the account level in every Region scope
    aws s3control put-public-access-block \
     --account-id 111122223333 \
     --public-access-block-configuration \
     BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
    
    # Confirm the configuration was applied
    aws s3control get-public-access-block --account-id 111122223333
    

    For EBS snapshots, the public-share control is EbsBlockPublicAccess (account-level) and the per-snapshot CreateVolumePermission. Public AMIs are blocked by enabling Block Public Access for AMIs at the account level. RDS and Redshift snapshots are shared cross-account via the snapshot-attribute API; the controlling Config rule names are rds-snapshots-public-prohibited and redshift-cluster-public-access-check. Each remediation path is an SSM Automation document that revokes the public attribute, captures the change in CloudTrail, and posts a Security Hub finding update.

    # Block public access for EBS snapshots at the account level
    aws ec2 enable-snapshot-block-public-access --state block-all-sharing
    
    # Block public access for AMIs at the account level
    aws ec2 enable-image-block-public-access --image-block-public-access-state block-new-sharing
    
    # Remove a public share from a single RDS snapshot
    aws rds modify-db-snapshot-attribute \
     --db-snapshot-identifier prod-payments-2024-q4 \
     --attribute-name restore \
     --values-to-remove all
    

    ⚠️ Anti-Pattern: Relying on the Trusted Advisor "S3 Bucket Permissions" check as the sole control. Trusted Advisor checks run on a multi-hour cadence, are best-effort, and do not block a misconfiguration at the time it happens. The defense-in-depth pattern is account-level BPA enforced by SCP, plus Config rules with auto-remediation, plus IAM Access Analyzer continuous external-access findings.

    🎯 Scenario: A platform team complains that a Lambda function deployed by a CI pipeline cannot make an EBS snapshot public for a partner. The investigation shows that enable-snapshot-block-public-access is set to block-all-sharing and an SCP denies ec2:DisableSnapshotBlockPublicAccess. The correct response is not to weaken the control. Move the snapshot to a partner-shared account by ModifySnapshotAttribute with the partner account ID, or copy the snapshot to the partner account through cross-account snapshot sharing. Public sharing is never the right primitive for a known partner.

    Decision Anchor: Choose account-level Block Public Access plus SCP denies for any greenfield or migration environment where no public sharing is required. Choose per-resource sharing with explicit AWS principal ARNs for partner-integration accounts that require selective cross-account access.

    The output is a single design artifact that lists every workload, its layer coverage, its central destination, its retention class, and its encryption key. The artifact is the foundation for every later design choice in the chapter.


    Continue with the interactive course

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