hi all, assuming I have two stacks: `API.ts` --&...
# help
t
hi all, assuming I have two stacks:
API.ts
--> this uses
sst.Api
Storage.ts
--> this uses
rds.ServerlessCluster
How can I give the API stack permission to access the RDS instance. I see examples where you can do
api.attachPermissions
from within
API.ts
, but then I don't have reference to the RDS construct. Is there a pattern for passing around construct references in the constructors of the stacks? How else would you accomplish this? Thanks!
a
Check out https://docs.serverless-stack.com/advanced/cross-stack-references But it's as simple as: •
public readonly db: rds.ServerlessCluster
in
Storage.ts
• and pass the
db
into the
API
stack via constructor props.
CDK takes care of the rest!
f
@Tim Alander yeah @Akos is 🎯. Let me know if it works for u.