Courseiva
Database SecurityhardMultiple ChoiceObjective-mapped

Restrict RDS Access with Security Groups: The Most Secure Configuration

A security engineer is designing a VPC with an RDS instance. The database must not be accessible from the internet, but EC2 instances in a private subnet must connect. Which security group configuration is MOST secure?

Quick Answer

The answer is to set the RDS security group inbound rule to allow traffic from the EC2 security group on port 3306. This is the most secure configuration because it uses a security group reference as the source rather than a CIDR block, which adheres to the principle of least privilege by granting access only to instances associated with that specific EC2 security group. On the AWS Certified Database Specialty DBS-C01 exam, this concept tests your understanding of how to restrict network access to an RDS instance without exposing it to the internet, and a common trap is choosing a CIDR-based rule that might inadvertently allow broader access or require manual updates. Remember that security group references automatically scale with your EC2 fleet, eliminating the need to manage IP ranges. Memory tip: think “SG-to-SG, not IP-to-IP” for the most secure database access.

⚠ Common exam trap

Watch out — candidates often choose a CIDR-based rule (like the private subnet CIDR) thinking it is sufficiently restrictive, but they overlook the superior security and operational benefits of using a security group reference, which is a key concept tested in the DBS-C01 exam for database security.

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

Set the RDS security group inbound rule to allow traffic from the EC2 security group on port 3306.

The most secure because it uses a security group reference instead of a CIDR block. By referencing the EC2 security group as the source in the RDS security group inbound rule, only instances associated with that specific security group can communicate with the database on port 3306. This approach adheres to the principle of least privilege and automatically scales as instances are added or removed from the EC2 security group, without needing to update CIDR ranges.

Answer analysis

Option-by-option breakdown

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

  • Set the RDS security group inbound rule to allow traffic from the VPC CIDR on port 3306.

    Why it's wrong here

    This allows all resources in the VPC, too broad.

  • Set the RDS security group inbound rule to allow traffic from 0.0.0.0/0 on port 3306.

    Why it's wrong here

    This exposes the database to the internet.

  • Set the RDS security group inbound rule to allow traffic from the private subnet CIDR on port 3306.

    Why it's wrong here

    This allows all resources in the subnet, not just EC2.

  • Set the RDS security group inbound rule to allow traffic from the EC2 security group on port 3306.

    Why this is correct

    This is the most secure, least-privilege approach.

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)

About these practice questions

Courseiva writes every DBS-C01 question from scratch — 1,663 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

Same concept, more angles

5 more ways this is tested on DBS-C01

These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.

Variation 1. A security audit reveals that an Amazon RDS for MySQL DB instance is accessible from the internet. The security team requires that the database be accessible only from a specific set of application servers within the same VPC. Which solution should be implemented?

easy
  • A.Modify the DB instance's security group to allow inbound traffic only from the application servers' security group.
  • B.Apply a network ACL that denies inbound traffic from 0.0.0.0/0 and allows from the application servers' IP range.
  • C.Enable encryption at rest on the DB instance to prevent unauthorized access.
  • D.Move the DB instance to a private subnet and configure a bastion host for access.

Why A: Modifying the DB instance's security group to allow inbound traffic only from the application servers' security group restricts access to only those instances, using the security group as a source for a more dynamic and manageable solution. Option B is incorrect because network ACLs are stateless and apply at the subnet level, not the instance level, and allowing from the application servers' IP range is less flexible and secure than using security group references. Option C is incorrect because enabling encryption at rest protects data at rest but does not control network access. Option D is incorrect because moving to a private subnet and using a bastion host is unnecessary when the application servers are in the same VPC; a security group rule is simpler and more appropriate.

Variation 2. A company is deploying a new Amazon RDS for MySQL database in a VPC. The database must be accessible only from an application server running in the same VPC. The security team also wants to ensure that the database is not accessible from the internet. Which TWO configurations are required? (Choose TWO.)

easy
  • A.Place the DB instance in a public subnet.
  • B.Modify the DB parameter group to restrict network access.
  • C.Configure the security group to allow inbound traffic only from the application server's security group.
  • D.Set the DB instance to be not publicly accessible.
  • E.Configure a network ACL to deny inbound traffic from 0.0.0.0/0.

Why C: To meet the requirements, two configurations are needed. First, the DB instance must be set to not publicly accessible (Option D) to ensure it cannot be reached from the internet. Second, the security group associated with the DB instance must allow inbound traffic only from the application server's security group (Option C), which restricts access to resources within the VPC. Option A is incorrect because placing the DB instance in a public subnet would expose it to the internet. Option B is incorrect because the DB parameter group controls database engine settings, not network access. Option E is incorrect because network ACLs are stateless and a rule denying all inbound traffic would block legitimate traffic as well; security groups are the appropriate mechanism for this scenario.

Variation 3. A company has an Amazon RDS for MySQL DB instance that is publicly accessible. The security team wants to restrict access to only specific IP addresses. Which configuration should be used?

medium
  • A.Create a VPC endpoint for RDS and attach a policy that allows only the specific IP addresses.
  • B.Use an IAM policy with a condition that restricts the source IP address.
  • C.Configure a security group associated with the RDS instance to allow inbound traffic only from the specific IP addresses.
  • D.Configure a network ACL to allow inbound traffic from the specific IP addresses.

Why C: A security group associated with the RDS instance can be configured to restrict inbound traffic to specific IP addresses, even if the instance is publicly accessible. Option A is incorrect because a VPC endpoint is used for private connectivity from within a VPC, not for restricting public access. Option B is incorrect because IAM policies control permissions for API actions, not network-level access. Option D is incorrect because network ACLs are stateless and applied at the subnet level, and while they can filter IP traffic, security groups are the more appropriate and granular control for individual RDS instances.

Variation 4. A company has an Amazon RDS for Oracle DB instance that is publicly accessible. They want to restrict access to only a specific CIDR block. Which two actions must be taken together?

medium
  • A.Modify the VPC security group to allow inbound traffic on the database port from the specific CIDR, and ensure the DB instance is publicly accessible with the correct security group.
  • B.Modify the DB subnet group to include only subnets from the allowed CIDR.
  • C.Add a rule to the network ACL to allow inbound traffic from the CIDR.
  • D.Set the rds.force_ssl parameter to force encrypted connections from the allowed CIDR.

Why A: You must modify the VPC security group to allow inbound traffic on the database port from the specific CIDR, and the DB instance must be configured as publicly accessible with that security group attached. Option B is wrong because the DB subnet group determines which subnets the instance can be deployed in, not inbound access restrictions. Option C is wrong because network ACLs operate at the subnet level and are less granular; security groups are the appropriate mechanism for RDS access control. Option D is wrong because the rds.force_ssl parameter enforces encrypted connections but does not restrict by source IP or CIDR.

Variation 5. Which TWO actions should a company take to secure an Amazon RDS for MySQL database that is accessible from the internet? (Choose two.)

medium
  • A.Use a security group that restricts inbound traffic to only the required IP addresses.
  • B.Disable encryption at rest to reduce latency.
  • C.Use the default VPC with a public subnet and a network ACL that allows all traffic.
  • D.Launch the DB instance in a public subnet with a public IP address.
  • E.Place the DB instance in a private subnet without a public IP address.

Why A: Options A and E are correct. Option A: Using a security group to restrict inbound traffic to only required IP addresses limits exposure to the internet. Option E: Placing the DB instance in a private subnet without a public IP address ensures it is not directly accessible from the internet. Option B is incorrect because disabling encryption at rest reduces security and does not address internet accessibility. Option C is incorrect because using the default VPC with a public subnet and a network ACL that allows all traffic increases exposure. Option D is incorrect because launching the DB instance in a public subnet with a public IP address makes it directly reachable from the internet.

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DBS-C01 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 DBS-C01 exam.