AWS Data Engineering
VPC, Networking, and Why Your Pipeline Can’t Connect to Anything
DataForge AWS Data Engineering Series - Blog 4 of 20
The Glue job timed out after 10 minutes trying to reach the source database. No error. No access denied. Just silence, then a timeout.
The data engineer checked IAM first — permissions were correct, confirmed with the policy simulator from Blog 3. Checked the database credentials — correct, tested manually from a laptop. Checked the connection string — correct. Two hours in, someone finally checked the VPC configuration: the Glue job was running in a subnet with no route to the database’s subnet, and no NAT gateway to reach anything outside the VPC at all. The job wasn’t being denied. It was shouting into a room with no doors.
This is what makes networking failures different from every other category covered so far in this series. IAM failures (Blog 3) tell you clearly that something was denied. Networking failures tell you nothing — the request simply never arrives, and every symptom looks identical to “the service is down,” “the credentials are wrong,” or “the job is stuck.”
Understanding VPC networking well enough to diagnose this quickly, rather than spending two hours ruling out everything else first, is what this article is for.
Let’s go deep.
TL;DR
VPC networking determines whether a request can physically reach its destination — a separate concern from IAM, which determines whether the request is allowed once it arrives. Subnets, route tables, security groups, and VPC endpoints together form the path a packet must successfully traverse before IAM even gets evaluated. Data engineering services (Glue, EMR, Lambda) that need to reach S3, databases, or the internet all depend on this path being correctly configured — and a missing piece produces a timeout, not an error message that names the problem.
By the end of this article you’ll be able to:
- Explain the difference between public and private subnets and which one your data services actually need
- Configure VPC endpoints correctly to avoid NAT gateway costs and reach AWS services privately
- Diagnose “can’t connect” failures by separating networking problems from IAM problems systematically
- Understand why Glue and EMR jobs behave differently in VPC contexts than Lambda functions do
Series context: This completes the “why won’t my pipeline start or connect” foundation alongside Blog 3 (IAM). Together, these two articles cover the two categories of failure that produce silence or generic errors instead of clear diagnostics — the hardest kind to debug without a system for it.

The Two Questions Every Network Request Answers
Every request your pipeline makes — Glue reading a database, Lambda calling an API, EMR reaching S3 — passes through two independent evaluation systems, in a specific order.
Question 1 (Networking): CAN this request physically reach
its destination?
Evaluated by: VPC, subnets, route tables, security groups,
network ACLs
Failure mode: timeout, connection refused, no response at all
Question 2 (IAM, from Blog 3): IS this request ALLOWED to
perform this action?
Evaluated by: identity policies, resource policies, trust
policies
Failure mode: explicit AccessDenied error
The request must pass Question 1 before Question 2 is even
evaluated. A networking failure never produces an IAM error —
because the request never got far enough for IAM to weigh in.
This is the single most useful diagnostic fact in this entire article. If you’re getting an explicit AccessDenied, networking is not your problem — the request reached AWS and was evaluated. If you're getting a timeout, hang, or generic connection error, IAM is very unlikely to be your problem — the request never got that far.
VPC Fundamentals: The Concepts Data Engineers Actually Need
A VPC (Virtual Private Cloud) is an isolated network within AWS. Everything inside it — EC2 instances, EMR clusters, RDS databases, Lambda functions configured to use it — communicates according to rules you define.
VPC
|
+-- Subnets - subdivisions of the VPC's IP range,
| each tied to one Availability Zone
|
+-- Route Tables - rules determining where traffic goes
| based on destination IP
|
+-- Security Groups - stateful firewall rules attached
| to individual resources
|
+-- Network ACLs - stateless firewall rules attached
| to entire subnets
|
+-- Internet Gateway / NAT Gateway - the exit points
to the internetThe concept that matters most: public vs private subnets.
Public subnet:
Route table has a route to an Internet Gateway
Resources CAN have public IP addresses
Resources can reach the internet directly
Private subnet:
Route table has NO route to an Internet Gateway
Resources cannot have public IP addresses
Resources can only reach the internet through a
NAT Gateway (if one is configured) - one-way outbound only
Why data engineering workloads almost always belong in private subnets: a Glue job, EMR cluster, or RDS database processing production data should not be directly reachable from the internet. Private subnets provide this by design — there’s no route in unless you explicitly build one. The trade-off is that reaching the internet (for package installs, external API calls) requires a NAT Gateway, which costs money and adds a hop.
How a Request Actually Traverses the Network: The Mechanism
This is the mechanism worth understanding precisely — because once you see the actual path a request takes, “why can’t my Glue job reach S3” stops being mysterious.
Walk through two scenarios: a Glue job reaching S3, and the same job reaching an on-premises database.
Scenario A: Glue job (in private subnet) reads from S3
Without a VPC endpoint:
Glue job -> private subnet -> NAT Gateway -> Internet Gateway
-> public internet -> S3's public endpoint
Requires: NAT Gateway configured and route table pointing to it
Cost: NAT Gateway data processing charges (~$0.045/GB)
Latency: extra hop through NAT
With an S3 VPC Gateway Endpoint:
Glue job -> private subnet -> VPC Endpoint (S3) -> S3 directly
Requires: VPC endpoint created, route table updated
Cost: FREE (Gateway endpoints for S3 have no hourly charge)
Latency: direct, no NAT hop
Traffic never leaves the AWS network
Scenario B: Glue job (in private subnet) reads from an
on-premises database via VPN
Glue job -> private subnet -> route table entry for the
on-prem CIDR range -> Virtual Private Gateway
-> VPN tunnel -> on-premises network -> database
Requires: VPN or Direct Connect configured, route table
entry for the specific on-prem IP range,
security group allowing the database port,
on-prem firewall allowing the VPC's CIDR range
Missing ANY of these: timeout. No error. No hint which
piece is missing.
The diagnostic takeaway: every hop in this path is a place where the connection can silently fail. A route table missing an entry, a security group not allowing the port, a NAT gateway that was deleted to save cost, a VPN tunnel that dropped — all produce the identical symptom of “it just doesn’t connect.”
VPC Endpoints: The Configuration Most Teams Skip
VPC endpoints let resources in a private subnet reach AWS services without going through a NAT Gateway or the public internet. For data engineering, this is not a nice-to-have — it’s a significant cost and reliability lever that most teams never configure.
Two types of VPC endpoints:
Gateway Endpoints (S3 and DynamoDB only):
Free
Configured as a route table entry
Traffic never leaves AWS's network
Interface Endpoints (most other services):
Hourly charge (~$0.01/hour per AZ) + data processing charge
Creates an Elastic Network Interface in your subnet
Used for: Glue, Athena, Redshift Data API, Secrets Manager,
CloudWatch Logs, Step Functions, SNS, SQS, and
most other AWS services
The cost calculation that justifies this configuration:
Without S3 Gateway Endpoint:
Glue job processes 500GB/day through NAT Gateway
500GB x $0.045/GB = $22.50/day = $675/month in NAT
data processing charges alone (before NAT hourly cost)
With S3 Gateway Endpoint:
Same 500GB/day, $0 in data processing charges
(Gateway endpoints for S3 are free)
Monthly savings: $675+
Configuration cost: one route table entry, zero ongoing cost
Why this matters beyond cost: NAT Gateways are also a single point of failure and a throughput bottleneck (default limit ~45Gbps, but shared across everything routing through it). A data platform with multiple concurrent Glue jobs, EMR clusters, and Lambda functions all routing S3 traffic through the same NAT Gateway can hit throughput ceilings that VPC Gateway Endpoints eliminate entirely by bypassing NAT altogether.
Security Groups: Stateful Rules That Actually Matter
Security groups are the firewall rules attached directly to resources (EC2 instances, RDS databases, EMR cluster nodes, Lambda functions in a VPC). They’re stateful — if you allow inbound traffic on a port, the response traffic is automatically allowed back out, without needing a matching outbound rule.
Common data engineering security group pattern:
EMR cluster security group:
Inbound: allow all traffic from the SAME security group
(nodes need to talk to each other for Spark's
internal shuffle and coordination traffic)
Inbound: allow SSH (port 22) from a specific bastion host
or VPN CIDR range only - never 0.0.0.0/0
Outbound: allow all (or scoped to specific destinations
if strict egress control is required)
RDS database security group:
Inbound: allow the database port (5432 for PostgreSQL,
3306 for MySQL) FROM the security group of
whatever needs to connect (Glue, EMR, Lambda)
Outbound: typically not needed for RDS
The pattern that eliminates a whole category of errors: reference security groups by ID as the source, not by IP range. Allow port 5432 from sg-glue-jobs is more maintainable and more correct than Allow port 5432 from 10.0.1.0/24, because it automatically covers any resource in that security group regardless of which subnet or IP it lands in — including after autoscaling adds new instances.
The specific EMR trap: EMR cluster nodes need to communicate with each other on a wide range of ports for Spark’s internal operation (shuffle service, block manager, driver-executor communication). If you create a custom security group instead of using the one EMR auto-generates, and you don’t replicate this intra-cluster communication rule, Spark jobs fail with mysterious executor communication timeouts that have nothing to do with your actual code.
Glue, EMR, and Lambda: Different Networking Models
The three most common compute services in this series have meaningfully different relationships with VPC networking — a fact that causes confusion when engineers assume they all work the same way.
AWS Glue:
Runs in AWS-managed infrastructure by default
To reach VPC resources (RDS, private subnets), you
configure a Glue Connection with VPC/subnet/security
group info - Glue then provisions ENIs in your subnet
to bridge into your VPC
Without a VPC connection: Glue can reach public
internet + AWS services directly, but NOT your
private VPC resources
EMR:
Runs directly IN your VPC, in a subnet you specify
at cluster creation
Full control over the cluster's networking -
it's just EC2 instances in your subnet
Requires more explicit configuration (security groups,
subnet choice) but no separate "connection" abstraction
Lambda:
By default, runs in an AWS-managed VPC with full
internet access and access to AWS services - but
NO access to your private VPC resources
To reach a VPC resource (RDS, private subnet),
you must explicitly attach the Lambda function to
your VPC - which then REMOVES its default internet
access unless you also configure a NAT Gateway or
VPC endpoints
The Lambda trap that catches almost everyone once: attaching a Lambda function to a VPC (to reach an RDS database, for example) silently removes its ability to reach the public internet and other AWS services unless you’ve configured NAT or VPC endpoints. A Lambda function that worked fine calling an external API suddenly times out after being VPC-attached for database access — because VPC attachment is all-or-nothing for that function’s networking context, not additive.
Diagnosing Connection Failures Systematically
This is the diagnostic workflow that replaces “check everything randomly” with a structured process — the networking equivalent of Blog 3’s IAM diagnostic workflow.
Connection timeout or hang (no explicit error)
|
v
Step 1: Confirm this is a networking issue, not IAM
Explicit AccessDenied -> not networking, go to Blog 3's
diagnostic process instead
Timeout / hang / connection refused -> continue
|
v
Step 2: Is the source resource in a VPC at all?
Glue: check if a VPC Connection is configured
Lambda: check if VPC configuration is set
EMR: always in a VPC - check which subnet
|
v
Step 3: Does the route table for that subnet have a path
to the destination?
Destination is S3/DynamoDB -> needs Gateway Endpoint
OR NAT Gateway route
Destination is another AWS service -> needs Interface
Endpoint OR NAT Gateway
Destination is on-premises -> needs VPN/Direct Connect
route entry
Destination is public internet -> needs NAT Gateway
(private subnet) or
Internet Gateway (public)
|
v
Step 4: Does the security group allow the traffic?
Check OUTBOUND rules on the SOURCE resource's security group
Check INBOUND rules on the DESTINATION resource's security
group, sourced from the correct security group or CIDR
|
v
Step 5: Does the Network ACL allow the traffic (if customized)?
Default NACLs allow everything - only check this if
someone has customized NACLs, which is uncommon but
when present is stateless (needs explicit inbound
AND outbound rules, unlike security groups)
|
v
Step 6: For cross-VPC or cross-account: is VPC Peering or
Transit Gateway configured, with routes on BOTH sides?The tool that shortcuts most of this: VPC Reachability Analyzer simulates the path between two resources and tells you exactly which hop fails — route table, security group, or NACL — without needing to actually run the pipeline and wait for a timeout.
Architecture Flow: Networking Across a Complete Pipeline
Internet
|
| (only if public subnet + Internet Gateway)
v
+--------------------------------------------------------+
| VPC |
| |
| +--------------------------------------------+ |
| | Public Subnet | |
| | - NAT Gateway (for private subnet egress) | |
| | - Bastion host (if needed for SSH access) | |
| +--------------------------------------------+ |
| |
| +---------------------------------------------+ |
| | Private Subnet | |
| | - EMR cluster nodes | |
| | - RDS database | |
| | - Lambda (VPC-attached) | |
| | - Glue Connection ENIs | |
| | | |
| | Route table: | |
| | S3/DynamoDB -> Gateway Endpoint (free) | |
| | Other AWS services -> Interface Endpoints| |
| | Internet -> NAT Gateway (paid, in public | |
| | subnet) | |
| | On-prem -> VPN/Direct Connect | |
| +---------------------------------------------+ |
+--------------------------------------------------------+
|
| VPC Gateway Endpoint (free, direct)
v
S3 (never touches the public internet)Failure Modes You’ll See in Production
The Glue job in a subnet with no route anywhere. The opening scenario. A Glue Connection is configured pointing to a subnet that has no NAT Gateway and no VPC endpoints — the job can reach nothing outside its own VPC, and every connection attempt times out silently with no indication of why.
NAT Gateway deleted to save cost, breaking everything downstream. A cost optimization pass identifies an “unused” NAT Gateway and deletes it to save the hourly charge. Every private-subnet resource that depended on it for internet or AWS service access starts failing immediately — but the failures look like service outages, not a networking change, because nobody connects “we deleted a NAT Gateway last week” to “Lambda functions can’t reach external APIs anymore.”
Lambda VPC attachment silently removing internet access. A Lambda function is attached to a VPC to reach an RDS database. The same function also calls an external payment API. After VPC attachment, the API calls start timing out — because VPC attachment removed default internet access, and nobody configured a NAT Gateway or realized this was necessary.
Security group referencing the wrong source. An RDS security group allows inbound traffic from a specific IP CIDR range instead of a security group ID. When the Glue job’s underlying infrastructure changes IP ranges (which AWS does without notice for managed services), the previously working connection silently breaks with no configuration change visible in either the Glue or RDS console.
EMR cluster with a custom security group missing intra-cluster rules. A security team creates a “locked down” security group for an EMR cluster, replacing the auto-generated one, without preserving the rule allowing all traffic between nodes in the same security group. Spark jobs fail with executor communication timeouts that look like application-level bugs but are actually a missing security group rule.
VPC Peering configured on only one side. Two VPCs are peered to allow a data pipeline in VPC A to reach a database in VPC B. The peering connection is accepted, but the route table in VPC B is never updated to route traffic back to VPC A. Requests from A to B work; responses never make it back, producing a connection that appears to hang indefinitely.
Trade-offs: What VPC Networking Optimizes For
VPC networking optimizes for:
- Network isolation — resources are unreachable by default unless explicitly connected
- Granular traffic control — security groups and NACLs provide layered, auditable rules
- Cost efficiency when configured correctly — VPC endpoints eliminate NAT charges for AWS-to-AWS traffic
- Compliance and security boundary enforcement — private subnets keep sensitive data processing off the public internet
VPC networking doesn’t optimize for:
- Debuggability — failures are silent timeouts, not descriptive errors
- Fast iteration — testing network changes often requires actually running a job and waiting for timeout to confirm a fix
- Simplicity — a production data platform accumulates VPC endpoints, route table entries, security group rules, and peering connections that are hard to audit holistically
- Cross-team coordination — network changes made by an infrastructure team can silently break data pipelines owned by a different team, with no automatic notification
The honest trade-off: VPC networking gives you precise control over what can reach what. The cost is that this precision is invisible until it fails, and failures give you almost no diagnostic information beyond “it didn’t work” — which is why the systematic diagnostic workflow in this article matters more here than almost anywhere else in AWS.
Real-World Constraints
NAT Gateway is a per-AZ resource with bandwidth limits. A single NAT Gateway serves one Availability Zone. High-throughput data pipelines running across multiple AZs need a NAT Gateway per AZ for both reliability (AZ failure isolation) and to avoid cross-AZ data transfer charges, which apply even within the same region if traffic crosses AZ boundaries through a single NAT Gateway.
VPC Interface Endpoints have per-AZ hourly costs. Unlike the free S3/DynamoDB Gateway Endpoints, Interface Endpoints (for Glue, Secrets Manager, CloudWatch Logs, etc.) charge per AZ per hour. A data platform using 5 interface endpoints across 3 AZs pays for 15 endpoint-hours continuously — a real but often overlooked recurring cost that should be weighed against NAT Gateway data processing charges for the same traffic.
Security group rule limits. Each security group supports a limited number of inbound/outbound rules (60 by default, can be raised). Complex data platforms with many fine-grained access patterns can hit this limit, forcing either rule consolidation (using broader CIDR ranges, reducing precision) or splitting resources across multiple security groups.
What This Means for the Rest of the Series
Every compute service covered from Blog 5 onward inherits the networking model from this article:
Blog 5 (Glue): VPC Connections determine whether a Glue
job can reach RDS, on-prem systems, or
stays limited to public internet + AWS
services
Blog 6 (Redshift): cluster subnet groups and security
groups determine which resources can
query the warehouse
Blog 8 (Kinesis) / Blog 9 (MSK): MSK clusters run inside
a VPC with the same subnet
and security group
considerations as EMR
Combined with Blog 3’s IAM patterns, this article completes the two-part foundation every subsequent service depends on: can the request reach its destination (networking), and is it allowed to act once it arrives (IAM).
Summary: The Engineering Lesson
Networking failures are the quietest failures in AWS. They don’t tell you what’s wrong. They don’t tell you which layer failed. They just don’t work — and every layer between your service and its destination is a place where that silence can originate.
The Glue job from the opening scenario wasn’t misconfigured in any way IAM or the application code could reveal. It was correctly configured to fail — placed in a subnet with no path to anywhere, a networking decision made once during initial VPC setup and never revisited as the pipeline’s requirements grew.
The two-hour debugging session that started this article should have taken ten minutes. The difference between the two isn’t knowledge of every possible AWS networking feature — it’s a systematic process that checks the request’s actual path, hop by hop, before assuming the problem is somewhere else.
That process is what separates engineers who dread “it just won’t connect” tickets from engineers who resolve them before lunch.
Next in Series
Blog 5 - AWS Glue Deep Dive: ETL at Scale Without Managing Servers
With storage (Blog 2), access control (Blog 3), and networking (Blog 4) covered, we move into the compute layer — starting with the service most data engineering teams reach for first.
We’ll go deep on Glue’s actual execution model, DynamicFrames vs DataFrames, job bookmarks for incremental processing, the DPU cost model, and exactly where Glue’s serverless convenience trades off against the control you’d get from EMR — a decision this series will keep returning to throughout Phase 2.
Comment Below
What’s the longest you’ve spent debugging a connection that turned out to be a networking issue, not a code or permissions issue?
Was it a NAT Gateway quietly deleted during a cost cleanup? A Lambda function that lost internet access the moment it was VPC-attached for database access? An EMR cluster with a locked-down security group that broke Spark’s internal shuffle traffic?
And — how long did it take before someone thought to check the network path instead of the application?
Tags: aws-data-engineering, vpc, networking, security-groups, vpc-endpoints, aws-glue, emr, lambda, nat-gateway, dataforge