Multi-region serverless API deployments

Hello,

I’m currently developing a multi-region serverless application with AWS.

In order to optimize latency and improve availability, I’ve decided to follow this architecture coupled with a DynamoDB global table.

It seems to me that 3 regions is probably the sweet spot for a good balance between costs and latency.

Regarding this architecture, I have 2 questions:

a) How does pricing actually work for DynamoDB Global Tables?

This might might be a stupid question, but I’ve read and reread the pricing examples and can’t seem to get my head around on how I am charged.

Assuming an on-demand global table in the regions A, B and C, with 10M, 20M, and 30M writes respectively, could somebody please explain to me how does pricing work (ignoring data transfer and storage charges).

b) Latency between the west coast and N. Virginia X Latency between Asian users and Oregon

My targeted users are located mainly in the US, Europe and Asia (mostly Japan).

Using the feature availability, costs and geographical distribution criteria, I’ve already decided on this two regions:

  • N. Virginia (us-east-1)
  • Ireland (eu-west-1)

For my third region I’m undecided between Tokyo (ap-northeast-1) or Oregon (us-west-2).

I expect to have more usage initially in the west coast rather than in Asia. However, it seems to me that latency between services hosted in Virginia and end-users in the west coast is still very low and users in Asia seem to benefit greatly from an Asian region. Can anyone provide insight on this question?

Finally, I’d like to hear some feedback if there is anyone running similar architectures in prod.

Thanks and happy 2020!

How does pricing actually work for DynamoDB Global Tables?

How does pricing for anything in AWS work? FTFY

All joking aside, you could almost get a degree in AWS billing. The could have a cert for it easily.

As far as I can understand from the pricing page, you pay a different price for replicated writes from the AZ which has that write. ie, if a Write occurred against the us-east-1 Global table, you would pay that AZ price for it to be replicated to the other replica tables. Including the cost of the write to the us-east-1 table itself.

Write cost + Replica write cost = Total Write Cost.

You will also be charged data transfer out on replica writes, which is strange because it is always AWS to AWS.

https://aws.amazon.com/dynamodb/pricing/on-demand/

IMO; the latency of DynamoDB is extremely low to begin with. Using Ireland as your base point for now removes the requirement of replicating. Plus the cost of DynamoDB is extremely low. You are talking about $1 per Million writes. Once your application has taken off, look at replicating then.

The latency for DDB in my experience was <10ms, I had my table in Ireland and I’m in the UK.

One thing to consider is that you can’t make a table global once it has data in it, it has to be empty. So, if you’re going to do that in the future instead of now, you’ll need to migrate your data into a new table and account for whatever architecture and down time that requires.

you now can do this in a table with existing data. Check out new docs of requirements

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/V2globaltables_reqs_bestpractices.html

I thought if you made it global from the beginning you could then elect replicas later? Or am I mistaken?

That I don’t know. I’ve never setup a global table without a replica, but it’s not all one step, so in theory, yes?

I hadn’t heard of this! But I don’t see anything in the docs that spells this out. The example still does it using a new table.

compared to the previous version docs just below it: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables_reqs_bestpractices.html

It explicitly says the table must not have data, although the URL does have “latest” in it. Rather than updating the new documentation to say that you can have data, I think they just took it out. Makes sense for newcomers. It’s tough on us folks that can barely keep up with all the updates!

Seriously. Feature addition by omission :face_with_tongue: