Courseiva

SAP-C02 Continuous Improvement for Existing Solutions Practice Question

A company has deployed a web application on Amazon ECS with Fargate. The application needs to access an Amazon RDS database. The security team mandates that the database must not be publicly accessible. What is the best way to securely connect the ECS tasks to the RDS database?

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

✓

Place the ECS tasks and RDS instance in the same VPC, and configure security groups to allow traffic on the database port.

Placing ECS tasks and RDS in the same VPC allows private communication via security groups. This ensures the database is not publicly accessible. Option A is incorrect because a NAT gateway is for outbound internet access, not for inbound traffic to RDS. Option B is incorrect because an internet gateway would expose the RDS instance to the internet. Option C is incorrect because enabling public accessibility would violate the security mandate even with IP restrictions.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Use a NAT gateway to route traffic from ECS tasks to RDS.

    Why it's wrong here

    A NAT gateway only provides outbound internet access for private subnets; it does not create a path to a private RDS endpoint, and RDS traffic never traverses it. NAT gateways are for tasks needing outbound internet (package downloads, external APIs), not intra-VPC database connectivity.

  • ✗

    Attach an internet gateway to the VPC and route through it.

    Why it's wrong here

    An internet gateway routes traffic to and from the public internet and cannot reach a private RDS instance, which has no public address. Internet gateways are correct for public subnets hosting internet-facing resources such as ALBs, not for private database access from ECS tasks.

  • ✗

    Enable public accessibility on the RDS instance and restrict access to the ECS task public IP.

    Why it's wrong here

    Enabling public accessibility directly violates the mandate that the database must not be publicly accessible, and ECS Fargate task IPs are ephemeral, so allow-listing them is unworkable. Public accessibility suits databases deliberately reached from outside the VPC, which the security team here forbids.

  • ✓

    Place the ECS tasks and RDS instance in the same VPC, and configure security groups to allow traffic on the database port.

    Why this is correct

    Keeping both the Fargate tasks and the RDS instance in the same VPC lets traffic traverse private addresses, so the database never needs public accessibility. Security groups then restrict inbound access to the database port from the tasks' security group only.

Visual reference

Inside (Private) PC-A 10.0.0.1 PC-B 10.0.0.2 NAT Router Outside (Public) 203.0.113.1 Inside Global Server PAT: many private IPs share one public IP via unique port numbers

About these practice questions

One of 984 original SAP-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

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.