Troubleshoot RDS Connection Refused Errors with VPC Flow Logs and CloudWatch Metrics
An application running on EC2 instances occasionally throws 'Connection refused' errors when connecting to an RDS database. The SysOps administrator needs to determine if the issue is due to database connection limits or network security groups. Which metrics and logs should the administrator examine?
Quick Answer
The answer is to examine the RDS CloudWatch metric DatabaseConnections and analyze VPC Flow Logs for the EC2 instance's network interface. This combination is correct because "Connection refused" errors typically arise from either the database exhausting its maximum connections or network-level security groups blocking traffic; the DatabaseConnections metric directly shows the current active connections against the instance’s max_connections limit, while VPC Flow Logs capture whether packets are accepted or rejected by security groups or network ACLs, pinpointing network blockages. On the AWS Certified SysOps Administrator Associate SOA-C02 exam, this scenario tests your ability to differentiate between application-layer limits and network-layer denials when troubleshooting RDS connection refused errors using VPC Flow Logs—a common trap is to only check security group rules without verifying connection saturation. Remember the mnemonic "DB or Net" to recall that DatabaseConnections covers the database side, and VPC Flow Logs cover the network side.
⚠ Common exam trap
A common mix-up: candidates confuse aggregate network metrics (like NetworkIn/NetworkOut) or CPU metrics with the specific indicators needed to differentiate between connection limits and security group denials, leading them to choose options that measure volume rather than connection state or packet acceptance.
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
✓
Examine the RDS CloudWatch metric DatabaseConnections and analyze VPC Flow Logs for the EC2 instance's network interface.
'Connection refused' errors typically stem from either the database exhausting its maximum connections or network-level security groups blocking traffic. The RDS CloudWatch metric `DatabaseConnections` directly shows the current number of active connections against the instance's `max_connections` limit, while VPC Flow Logs capture whether packets are being accepted or rejected by security groups or network ACLs, pinpointing network blockages.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Check CloudWatch RDS CPUUtilization and CloudTrail logs for RDS API calls.
Why it's wrong here
CPUUtilization measures compute load and CloudTrail records RDS control-plane API calls, so neither exposes connection counts or security group behaviour. They are tempting for general RDS health monitoring, and would be correct if the symptom were slow queries or unauthorised configuration changes rather than refused connections.
- ✗
Review RDS error logs in CloudWatch Logs and check the EC2 instance's system log.
Why it's wrong here
The EC2 system log records operating-system and instance-level events, not database connection refusals or security group drops. RDS error logs are relevant, but pairing them with the system log leaves the network-security-group question unanswered; VPC Flow Logs and RDS DatabaseConnections would address both suspected causes.
- ✗
Look at the EC2 instance's CloudWatch NetworkIn and NetworkOut metrics and RDS FreeableMemory metric.
Why it's wrong here
NetworkIn and NetworkOut aggregate interface throughput and FreeableMemory tracks buffer cache pressure; neither reveals connection-limit exhaustion or security group rejections. These metrics are tempting for general performance triage, and would suit diagnosing bandwidth saturation or memory pressure rather than 'Connection refused' errors.
- ✓
Examine the RDS CloudWatch metric DatabaseConnections and analyze VPC Flow Logs for the EC2 instance's network interface.
Why this is correct
DatabaseConnections shows whether the RDS instance has hit its connection limit, while VPC Flow Logs reveal whether security groups or network ACLs are rejecting traffic. Together they distinguish a connection-limit problem from a network-blocking problem.
Go deeper
Related to this question
About these practice questions
One of 1,169 original SOA-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 →
Same concept, more angles
2 more ways this is tested on SOA-C02
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 company is experiencing intermittent performance issues with an application running on an EC2 instance. The CloudWatch metrics show high CPU utilization but no correlation with the timing of the issue. The SysOps administrator needs to collect detailed performance data to identify the root cause. Which AWS service should the administrator use to capture network-level metrics and logs?
medium- A.Configure a CloudWatch Logs agent on the instance to send application logs.
- ✓ B.Enable VPC Flow Logs for the EC2 instance's subnet.
- C.Use AWS CloudTrail to log all API calls made to the instance.
- D.Enable AWS Config to track configuration changes to the instance.
Why B: VPC Flow Logs capture IP traffic metadata (source/destination IP, ports, protocol, packet count) at the network interface level, which is essential for diagnosing network-related performance issues. Since the problem is intermittent and uncorrelated with CPU, network-level metrics can reveal issues like packet loss, throttling, or latency that application logs or CPU metrics alone cannot. This directly addresses the need for detailed network-level data.
Variation 2. An application is running on an EC2 instance and is experiencing intermittent connection timeouts. The SysOps administrator wants to capture network traffic to analyze the issue. Which AWS service should be used?
easy- A.CloudWatch Logs
- B.AWS CloudTrail
- C.AWS Config
- ✓ D.VPC Flow Logs
Why D: VPC Flow Logs capture IP traffic information for network interfaces in a VPC, including accepted and rejected connection attempts. This allows the SysOps administrator to analyze the source/destination IPs, ports, protocols, and whether the traffic was allowed or denied, which is essential for diagnosing intermittent connection timeouts.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This SOA-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 SOA-C02 exam.