Anyone happen to have an example repo using dynamo...
# help
g
Anyone happen to have an example repo using dynamo global tables and deploying an appsync api to each of the replicated regions? Curious about how to do this with SST and especially around setting up the domain to do latency based routing.
t
we were talking about this setup internally
we haven't put together a proof of concept with it but we want to make regional api gateway + regional lambda + global dynamodb tables an out of the box experience
g
Yeah that would be nice, right now it seems to be a very manual process to do multi-region deploys compared to just using the cdk itself. Interested to see what you guys come up with.
f
@thdxr this might be a good reason to allow stacks be deployed to different regions in an SST app?
g
If it was ever as easy as just:
Copy code
const regions = [
  'us-east-1',
  'us-west-1',
  ...
]

const data = new DataStack(app, 'Data', {
  region: 'us-east-1',
  replicateTo: regions.filter(r => r !== 'us-east-1')
})

const apis = [...regions].map(r => {
  return new ApiStack(app, `Api${r}`, {
    region: r,
    table: data.dynamodbTable
  })
})

new Route53Stack(app, 'Route53', {
  region: 'us-east-1',
  apiUrls: apis.map(api => api.url)
})
That would be super cool, obviously a few minor changes would need to be made specifically for local dev so its just one region not global table no route53 but would be easy enough to change per env given existing way apps are created basically just need the ability to add a region modifier.
Not sure how much would have to go into the SST side of that to actually enable deploying apps to multiple regions like that but if on the dev end for us it was ever that easy it would be really really nice