简体   繁体   中英

Connect aws postgres db to the vercel

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM