Courseiva

SAP-C02 Continuous Improvement for Existing Solutions Practice Question

A company runs a web application on EC2 instances behind an ALB. They want to improve the security posture by implementing defense in depth. Which TWO measures should they implement? (Choose TWO.)

⚠ Common exam trap

SAP-C02 often tests the confusion between network-layer controls (security groups, NACLs) and application-layer controls (WAF), tempting candidates to pick redundant or exposure-increasing options instead of complementary layers.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Configure security groups to restrict traffic to only necessary ports.

Option D is correct because security groups act as stateful virtual firewalls at the instance/ENI level, and restricting inbound rules to only the ports and protocols the application actually needs (for example, 443 from the ALB's security group rather than 0.0.0.0/0) enforces least privilege and shrinks the attack surface as part of a defense-in-depth strategy. Option E is correct because AWS WAF integrates with the Application Load Balancer to inspect HTTP/HTTPS requests and block common web exploits such as SQL injection and cross-site scripting using managed rule groups, adding a layer of protection that security groups cannot provide since they only filter at L3/L4. Option A is not appropriate because a public S3 bucket exposes static assets to unauthenticated access and weakens, rather than strengthens, the security posture; static content should be served via CloudFront with an origin access control or kept private. Option B is not appropriate because placing EC2 instances in public subnets gives them routable public IPs and needlessly exposes them to the internet; they should sit in private subnets behind the ALB. Option C is not appropriate because allowing direct internet access to the instances bypasses the ALB and WAF protections, contradicting the defense-in-depth goal.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Store static assets in a public S3 bucket.

    Why it's wrong here

    A public S3 bucket exposes static assets to anonymous internet access, removing an access-control layer rather than adding one, which contradicts defence in depth. It is tempting because S3 and CloudFront commonly serve static content, and a public bucket would be the right choice for a deliberately public website hosting openly distributable assets.

  • ✗

    Place EC2 instances in public subnets for easier management.

    Why it's wrong here

    Public subnets give instances routable addresses and a path to the internet gateway, exposing them directly and bypassing the ALB as the sole ingress point. It is tempting because public subnets simplify SSH administration and outbound patching, and they would be correct for bastion hosts or NAT instances that genuinely require public addressing.

  • ✗

    Allow direct internet access to the EC2 instances.

    Why it's wrong here

    Allowing direct internet access to the EC2 instances creates a second ingress path that circumvents the ALB's listener rules, TLS termination and WAF integration. It is tempting because direct access simplifies troubleshooting and deployment, and it would be correct for instances that must receive traffic independently of a load balancer.

  • ✓

    Configure security groups to restrict traffic to only necessary ports.

    Why this is correct

    Security groups act as stateful virtual firewalls at the instance level, permitting only required ports and protocols. Restricting inbound rules to necessary ports removes unnecessary exposure, forming one layer of defence in depth alongside load balancer and network controls.

  • ✓

    Use AWS WAF to filter common web exploits.

    Why this is correct

    AWS WAF inspects HTTP requests at the Application Load Balancer, filtering SQL injection, cross-site scripting and other common exploits before they reach EC2 instances. This adds an application-layer defence that security groups cannot provide, strengthening defence in depth.

Visual reference

192.168.1.0 /24 256 addresses (254 usable) 192.168.1.0 /25 Subnet A 128 addr (126 usable) 192.168.1.128 /25 Subnet B 128 addr (126 usable) Borrowing 1 bit from host portion creates 2 subnets (/25)

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

Courseiva writes every SAP-C02 question from scratch — 984 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

This SAP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SAP-C02 exam.