Keeping Data Services Private with Network Controls
This lesson explains how VPC design, endpoints and security groups keep data services off the internet while letting them reach each other and AWS APIs.
Learning outcomes
After completing this lesson, you will be able to:
- Place data services in private subnets with VPC endpoints.
- Configure a Glue connection for a VPC resource.
- Restrict access by network with aws:SourceVpce conditions.
Network controls
Network controls keep data services off the internet while letting them reach each other. Databases and clusters run in private subnets. A Glue connection to a VPC resource places Glue's network interfaces in a subnet, and their security group needs a self-referencing rule, allowing all traffic from the same group, so Glue's workers can talk to each other; the subnet also needs a route to S3. A gateway VPC endpoint gives private, free access to S3 and DynamoDB. Interface VPC endpoints give private access to services such as Glue, Athena, Kinesis, STS and Secrets Manager, and their endpoint policies limit which resources can be reached through them.
On the S3 side, access points give each application its own endpoint and policy on a shared bucket, and the aws:SourceVpce condition in a bucket policy rejects requests that do not arrive through a specific endpoint. Redshift enhanced VPC routing forces COPY and UNLOAD traffic through the VPC, so these controls apply to it. The following table summarises the controls.
| Control | Purpose |
|---|---|
| Private subnets | Keep databases and clusters off the internet |
| Self-referencing security group rule | Required for Glue connections to VPC resources (plus routes to S3) |
| Gateway VPC endpoint | Private access to S3 and DynamoDB |
| Interface VPC endpoints | Private access to Glue, Athena, Kinesis, STS, Secrets Manager and more; endpoint policies limit what is reachable |
| S3 Access Points | Per-application endpoint and policy on a shared bucket |
aws:SourceVpce in bucket policies | Require access through specific endpoints |
| Redshift enhanced VPC routing | Force COPY and UNLOAD through the VPC |
Network controls
Glue in a VPC
A Glue job that reads a database in a private subnet must run inside the VPC, which needs several pieces of configuration. A Glue connection specifies the VPC, subnet and security group in which the job's workers are placed. The security group needs a self-referencing inbound rule, allowing all traffic from the same security group, because Glue workers communicate with each other during a Spark job; without it, jobs fail to start.
Running in a private subnet also removes direct internet access, so the job needs other paths to the AWS services it uses. An S3 gateway endpoint, or a NAT gateway, lets it read its script and write results to Amazon S3, and interface endpoints are needed for any other AWS APIs the job calls, such as AWS Secrets Manager for database credentials.
The following diagram shows the network pieces the job needs.

Glue in a private subnet
Restricting access by network
Policies can require that data is accessed only from expected networks. Bucket policies with aws:SourceVpce or aws:SourceVpc deny requests from anywhere else, and VPC endpoint policies with aws:ResourceOrgID stop workloads reaching buckets outside the organisation, which closes a common data exfiltration path.
Stopping exfiltration
A Glue job reaching a private database securely
A Glue job must read from a database in a private subnet without internet access. The following table identifies the design element that meets each requirement.
| Requirement | Design |
|---|---|
| The database is in a private subnet | Glue connection in the same VPC and subnet |
| Glue workers must talk to each other | Security group with a self-referencing inbound rule |
| Glue needs S3 without internet access | S3 gateway endpoint in the route table |
| Least privilege | Job role can read only the secret, the source bucket and the target prefix |
Missing the self-referencing security group rule is the classic reason a VPC-connected Glue job fails to start, and missing the S3 endpoint the classic reason it hangs when writing results.
How can S3 traffic from a VPC stay off the internet?
Show answer
Through a gateway VPC endpoint for S3.
Exam Tips
Remember for the exam
- When Glue cannot reach a database, check the security group's self-referencing rule, the subnet routes and the endpoints.
- To keep S3 traffic off the internet, use a gateway VPC endpoint.
- For per-application access to a shared bucket, use S3 Access Points.
- To require access through your VPC, use aws:SourceVpce in bucket policies.
- To force COPY and UNLOAD through the VPC, enable Redshift enhanced VPC routing.