Hello. Does anyone know how to deploy a stack to s...
# help
a
Hello. Does anyone know how to deploy a stack to several regions so that the application works as quickly as possible for users around the world?
Copy code
export default function main(app: <http://sst.App|sst.App>): void {
  app.setDefaultFunctionProps({
    runtime: "nodejs14.x",
  });

  for (const region of ["us-west-1", "eu-central-1"]) {
    new CoreStack(app, "core-stack", { env: { region } });
  }
}
Will that be enough? Or should I create a new stack for each region and share all parts of the main one? https://docs.serverless-stack.com/constructs/Api#sharing-an-api-across-stacks Do I need to use load balancer? https://docs.serverless-stack.com/constructs/v1/Api#apialbrouteprops
d
Will that be enough? Or should I create a new stack for each region and share all parts of the main one?
for SST, you must deploy multiple times using the
--region
param for the CLI. You can use the current deploying region in the app/stacks though, to choose which parts to deploy in each region. Multi or single is up to you past that point.
Do I need to use load balancer?
Load balancers are more typically associated with the other side of an API gateway, and used for servers. Chances are good that you are more likely thinking of a flexible record in Route53, like a latency routing record: Choosing a routing policy - Amazon Route 53
a
How to set up DynamoDB replication correctly? I need to somehow synchronize all the data between the servers