Connect to a private database
Agents run in Astro’s managed cloud infrastructure. To reach a database that lives inside your VPN or private network, you need to do two things:
- Open your network to Astro’s outbound IPs so traffic can pass through your firewall.
- Pass the connection string to your agent as a secret input in
astropods.yml.
Both options below satisfy step 1. Choose based on your infrastructure.
Option 1: IP allowlisting
Agents egress through a fixed set of NAT Gateway Elastic IPs. Allowlisting these IPs in your firewall or VPN policy is the fastest path, requiring no AWS account or infrastructure changes on your side.
Get Astro's egress IPs
All agent workloads egress through the following static Elastic IPs. These are fixed and do not change unless we announce it:
Allowlist the IPs in your network
Add each IP to the inbound rules of whatever controls access to your database:
Use the port your database listens on. Common defaults: PostgreSQL 5432, MySQL 3306, MSSQL 1433, MongoDB 27017, Redis 6379. Check your database’s documentation if you’re unsure.
Declare the connection string in astropods.yml
Use inputs with secret: true so credentials are stored encrypted and never logged. The example below uses PostgreSQL; adjust the variable names and connection logic to match your database:
At deploy time, ast configure will prompt for the value. For PostgreSQL this looks like:
The format and client library will differ for other databases; refer to your database driver’s documentation. In your agent code, read the value from the environment:
Option 2: AWS PrivateLink
If your database (or a proxy in front of it) runs in an AWS VPC and your security policy does not allow inbound connections from public IPs, you can establish an AWS PrivateLink connection. Traffic flows entirely within the AWS backbone and never touches the public internet.
How it works:
Requirements:
- Your database is reachable from within an AWS VPC (RDS, Aurora, EC2-hosted, or any service behind an internal NLB).
- You can create a VPC Endpoint Service in that VPC.
Create an internal NLB targeting your database
In your AWS VPC, create an internal Network Load Balancer (NLB) that targets your database instance on its port. If your database is already behind a load balancer, you can skip this step.
Create a VPC Endpoint Service
Create a VPC Endpoint Service pointing to the NLB. In the AWS Console go to VPC → Endpoint Services → Create endpoint service, select your NLB, and note the generated service name, which looks like:
Contact Astro to establish the connection
Email support@astropods.com with the following:
We’ll authorize your account and create an Interface VPC Endpoint on our side.
PrivateLink requires the same astropods.yml input configuration as IP allowlisting (step 3 above). Only the network path differs.
Verifying the connection
The fastest way to confirm connectivity is to have your agent attempt a connection on startup and log the result before doing any real work. The exact approach depends on your database driver. If the agent starts successfully after deploy, the network path is clear. If it times out, the IPs are not yet allowlisted or the PrivateLink endpoint is not routing correctly; double-check the firewall rules and reach out to support@astropods.com.