Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect to Amazon RDS instance

I am trying to connect to an RDS instance via my Macbook (M1, Sonoma 14.2.1), and am constantly running into this error. Initially I thought the error was that my instance was not publicly accessible, which I have now changed.

Error message here:

Unable to connect to the database: HostNotFoundError [SequelizeHostNotFoundError]: getaddrinfo ENOTFOUND your_amazon_rds_host
at Client._connectionCallback (/Users/as/Desktop/sample_app/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:134:24)
at Client._handleErrorWhileConnecting (/Users/as/Desktop/sample_app/node_modules/pg/lib/client.js:327:19)
at Client._handleErrorEvent (/Users/as/Desktop/sample_app/node_modules/pg/lib/client.js:337:19)
at Connection.emit (node:events:519:28)
at Socket.reportStreamError (/Users/as/Desktop/sample_app/node_modules/pg/lib/connection.js:58:12)
at Socket.emit (node:events:519:28)
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    parent: Error: getaddrinfo ENOTFOUND your_amazon_rds_host
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
        errno: -3008,
        code: 'ENOTFOUND',
        syscall: 'getaddrinfo',
        hostname: 'your_amazon_rds_host'
    },
    original: Error: getaddrinfo ENOTFOUND your_amazon_rds_host
    at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:118:26) {
        errno: -3008,
        code: 'ENOTFOUND',
        syscall: 'getaddrinfo',
        hostname: 'your_amazon_rds_host'
    }
}

For what it's worth, here are some relevant details I have included in my .env file:

AWS RDS Instance:
Endpoint: database-1.servername.us-east-1.rds.amazonaws.com
Username: postgres
Password: RandomPassword
DB Instance Identifier: database-1
Database Port: 5432

Security Group Inbound Rules

Type: All traffic
Protocol: All
Port Range: All

What am I missing?

like image 429
user2762934 Avatar asked Dec 22 '25 06:12

user2762934


2 Answers

please check all these think

The error message you are encountering (getaddrinfo ENOTFOUND your_amazon_rds_host)

Check the RDS Instance Status

Correct Hostname or IP Address

Security Group and Firewall Settings

like image 103
Anjali Kesherwani Avatar answered Dec 23 '25 20:12

Anjali Kesherwani


Check your VPC and subnet in which you created your RDS

  • is it a public subnet or private subnet ? - use a public subnet
  • check NACL and Route table settings too - default ones allow all, but when you create new ones, they block all.
  • is there a Igw connected to your Route table ? - required for internet connection.
like image 24
Anuraag Moharana Avatar answered Dec 23 '25 20:12

Anuraag Moharana