When I run `sst deploy` my function can talk to my...
# help
m
When I run
sst deploy
my function can talk to my RDS DB just fine When doing
sst start
... no dice, the function can't reach RDS anymore
t
if your RDS db is in a VPC your local functions will not be able to talk to it
one of the reasons we put effort behind data api, it'll work in all environments
m
is that planned to be fixed at some point?
t
it's not anything we can do, you have to setup a VPN
another option is for local dev use 1. A local postgres instance (docker) 2. Use an RDS instance outside a VPN
I used to do #1 before I switched to data api
m
can't use aurora serverless outside vpc
f
Just wanted to chime in with some details on working with VPC https://docs.serverless-stack.com/live-lambda-development#working-with-a-vpc
m
thanks
f
I was also going to suggest placing the dev RDS in a public subnet. But I remember there were some issues with that setup, are resources in the PUBLIC subnet publicly accessible?
m
i'm using aurora serverless, it's VPC-only
oh i see what you mean
i'm not sure how that works
f
Something like:
Copy code
new RDS(this, "DB", {
  rdsServerlessCluster: {
    vpc,
    vpcSubnets: {
      subnetType: scope.local === true
        ? ec2.SubnetType.PUBLIC
        : ec2.SubnetType.PRIVATE,
    },
  },
});
I haven't tried this setup. Are the instances in the PUBLIC subnet publically accessible? 🤔
m
i'm not really clear on why it matters exactly? i don't know what the problem is with the DB being in the VPC is in the first place
it sounds like some SST implementation detail I am unfamiliar with
t
If a DB is in a VPC by default it is not publicly routable
the reason to put it in the VPC is exactly that, prevent it from being publicly routable
m
why does it need to be publicly routable is my question?
t
Your functions in sst start are running on your local machine
so they can't talk to a DB in a vpc without a vpn being in place
m
ah ic
t
You can disable local debugging: https://docs.serverless-stack.com/constructs/v1/Function#enablelivedev but maybe defeats the point
m
i'll look into the local pg setup