-1

I'd like to setup the most correct and lowest latency infrastructure for AWS.

I would like to serve static Javascript files over CloudFront, and on top of that - a call to a dynamic server that will return an invocation to a Javascript function that was declared before by the files served by the CloudFront - I found that this is the most optimal way to do that.

However, the dynamic call is dependant on a certain database (will probably end up being DynamoDB) that I want dispersed and replicated over many regions to decrease latency as much as possible.

My idea was having Lambda functions spread in multiple regions around the world retrieving data from DynamoDB replicas in their corresponding region in order to serve the dynamic parameters for the JS functions (Is there a way to make the Lambda functions not dependant and having the DynamoDB endpoint hard-coded in the code ?).

In addition to all of that, I'd like broad monitoring over every request made, is CloudWatch the best approach for that or should I store it directly in a MySQL Aurora database or DynamoDB of some sort ? What will be the best choice for monitoring purposes ?

Is that the best infrastructure possible for multi-million user based system, multi-regional, lowest possible latency and most scalable way ?

  • This smacks of *extremely* premature optimization. Do you *have* millions of users? Do your users care about 10-20 millisecond differences? – ceejayoz Jan 21 '18 at 21:41

1 Answers1

0

If you need dynamic requests in Cloudfront, you can use Lambda@edge.

Dynamodb is a good choice if your data access patterns don't require relations and you design your partition keys to avoid hot partitions from writes or reads.

Dynamodb supports multi region master to master replication.

Lambda is a handy tool, but suffers from cold starts on ~10% of requests when scaling up rapidly, so your 90th percentile latency will increase by ~10x. You might look into using Fargate to run full containers that auto scale instead of Lambda's auto scaling functions with Api Gateway.

Cloudwatch works for monitoring without requiring a lot of setup or use of third party tools.

Hope that helps.

devadvocate
  • 101
  • 2