Is there a way to break up stacks so that changes ...
# sst
k
Is there a way to break up stacks so that changes to one stack do not force a redeploy of the other? For instance DatabaseStack and ApiStack. Then I could redeploy only changes to ApiStack, hopefully speeding development. This seems to be related, but I haven’t sorted it out yet: https://docs.serverless-stack.com/constructs/Api#sharing-an-api-across-stacks
t
Yes you can create multiple stacks
And expose fields that can be referenced by another
k
Thanks! So if in my example I had a a “MainStack” with a bunch of stuff that was relatively static, and then an “ApiStack” where I was updating regularly… would this potentially speed development by reducing deployment time, or would the dependency “MainStack” get redeployed every time since it was a dependency?
t
Splitting up stacks will make certain things faster hard to simplify to exactly what
Deployments only deploy what's changed so a large stack is generally ok
k
Ok thanks, I’ll give it a shot… mainly trying to avoid having to wait 2 minutes every time I create a new handler file, which has been my experience so far
t
But there is a little overhead so I personally split stacks
d
Thanks for asking this question Kevin. To clarify for me, if I had these two lines in my
/stacks/index.js
they would count as different stacks correct?
Copy code
new MyStack(app, "my-stack", { url: URL });
new MarketingSiteStack(app, "marketing-stack", { url: URL });
f
That’s correct @Devin