Connect aws postgres db to the vercel

Viewed 802

i'm trying to connect to vercel with aws postgres db
I've created an instance of free tier rds and i got endpoint
so this is my server code

 const connection = await createConnection({
type: 'postgres',
url: process.env.DATABASE_URL,
logging: false,
synchronize: false,

entities: [
  User,
],
});

so my main question is how to create url

I've tried DATABASE_URL=postgresql://user:password@my aws endpoint:5432/my aws database name
and not worked vercel error said
ERROR : Task timed out after 10.01 seconds
What did I do wrong?

2 Answers

Go to the aws rds db instance, down on the right ( once you select the instance) there will be vpc security groups select it and add inbound and outbound firewall rules for the ip you are connecting with, if its your local it will be your wan ip. You can also test it with allow all traffic but I would strongly suggest against it.

Task timed out is almost always due to wrong or missing firewall rules. Verify that the RDS instance security group(s) has a rule for the vercel server.

Related