Lesson 6 of 6 Batch Ingestion and Integration Services

Connecting Pipelines to Data Sources with Drivers, Network Paths and Allowlists

This lesson explains the two things that must work before a pipeline can read a database, a driver that speaks its protocol and a network path its firewall accepts, which failed-connection questions almost always turn on.

Learning outcomes

After completing this lesson, you will be able to:

  • Distinguish JDBC from ODBC connections.
  • Configure security groups and network paths for sources in AWS.
  • Provide a fixed egress IP address for allowlisted external sources.

JDBC and ODBC

Java Database Connectivity (JDBC) and Open Database Connectivity (ODBC) are standard driver interfaces that let a program connect to a database through a connection URL, credentials and SQL, without knowing the database's internal protocol. JDBC is used by Java-based engines, which is why AWS Glue, Amazon EMR (Spark) and the Redshift and Athena JDBC drivers rely on it. ODBC is used by many desktop and business intelligence tools, such as Excel, Tableau and Power BI, which connect to Athena and Redshift through the ODBC drivers that AWS publishes.

In AWS Glue, a connection stores the JDBC URL, a reference to credentials in Secrets Manager and the VPC settings (subnet and security group) used to reach the database. Crawlers and jobs that use the connection run network interfaces in that subnet, so the database must be reachable from it. Athena reaches relational databases through federated query connectors, which run as Lambda functions and themselves use JDBC. The following table summarises who uses which interface.

ClientInterfaceTypical use
AWS Glue jobs and crawlersJDBC through a Glue connectionReading RDS, Aurora, Redshift and on-premises databases
Amazon EMR (Spark)JDBCReading or writing relational tables from Spark
BI and desktop toolsODBC (or JDBC)Querying Athena or Redshift from Tableau, Power BI or Excel
Athena federated queryLambda connector using JDBCJoining database tables with S3 data in SQL
Sort into groups

JDBC or ODBC?

Exam skills 1.2.2

Decide which driver interface each client usually uses.

Log in to try this activity Interactive activities are free with an account.

Network paths and security groups

A driver can only connect if the network allows it. For a source inside AWS, the database's security group must allow inbound traffic on its port from the client's security group, for example port 5432 from the Glue connection's security group. Glue additionally requires its security group to have a self-referencing rule that allows all traffic from itself, because Glue workers communicate with each other. Clients in private subnets reach AWS services such as S3 and Secrets Manager through VPC endpoints or a NAT gateway.

Troubleshooting

A Glue connection that cannot connect

Exam skills 1.2.2 · 4.1.1

Find why each Glue connection fails, choosing again until you find the fix.

Log in to try this activity Interactive activities are free with an account.

IP allowlists for external sources

Many sources outside AWS, such as on-premises databases, partner SFTP servers and SaaS APIs, accept connections only from allowlisted IP addresses. AWS services do not have fixed IP addresses by default, so the pipeline must be given one. The standard pattern is to run the client (a Glue job, Lambda function or EMR cluster) in a private subnet whose outbound traffic passes through a NAT gateway with an Elastic IP address; the source then allowlists that single address. A DMS replication instance or an EC2 instance can instead be given its own Elastic IP.

The direction can also be reversed: when an AWS service connects into a customer resource, the customer allowlists the service's published address ranges. For example, Amazon Data Firehose delivering to a publicly accessible Redshift cluster requires the cluster's security group to allow Firehose's CIDR block for that Region, and AWS publishes all service ranges in ip-ranges.json. The following table summarises the patterns.

SituationWhat to allowlist
Glue, Lambda or EMR reading an external database or APIThe Elastic IP of the NAT gateway used by the private subnet
DMS reading an on-premises databaseThe replication instance's IP (public or through VPN/Direct Connect)
Firehose writing to a publicly accessible Redshift clusterFirehose's CIDR block for the Region, in the cluster's security group
Any AWS service rangeAddress ranges from the published ip-ranges.json file

The following diagram shows the network path from a Glue job to a partner's database outside AWS.

A Glue job reaching a partner's PostgreSQL database outside AWS. The job's connection runs in a private subnet whose route table sends internet traffic to a NAT gateway with an Elastic IP address. The partner allowlists that one address, and the job reads its credentials from Secrets Manager through a VPC endpoint.
203.0.113.10 is a documentation address standing in for the NAT gateway's Elastic IP.
Match the pairs

What to allowlist

Exam skills 1.1.8

Match each connection with the address the other side must allowlist.

Log in to try this activity Interactive activities are free with an account.
Worked example

A Glue job that cannot reach a partner database

A Glue job must read a partner's PostgreSQL database hosted outside AWS. The partner's firewall accepts only allowlisted addresses, and the job times out. The team attaches a Glue connection with the JDBC URL and a Secrets Manager secret, places it in a private subnet whose route table sends internet traffic to a NAT gateway, and asks the partner to allowlist the NAT gateway's Elastic IP. The Glue security group keeps its self-referencing rule and allows outbound port 5432. The job now connects from a single, stable address.

Check yourself

What does a Glue connection store?

Show answer

The JDBC URL, a reference to the credentials in Secrets Manager, and the subnet and security group the job uses.

Exam Tips

Remember for the exam

  • Glue, EMR and the Redshift and Athena drivers use JDBC; BI and desktop tools commonly use ODBC.
  • A Glue connection stores the JDBC URL, a Secrets Manager reference and the subnet and security group.
  • Glue connections need a self-referencing security group rule.
  • To give a pipeline a fixed outbound IP for an allowlist, use a private subnet with a NAT gateway and an Elastic IP.
  • Firehose to a public Redshift cluster requires allowing Firehose's Regional CIDR block.