Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MoonMail Lambda architecture with Serverless

I've been looking into this project because the idea of having the whole system be a collection of Lambda functions seems very appealing. As a matter of fact, a few years ago I wrote some software that does pretty much the same as MoonMail does and it is due for an update as some specs have changed. I'm evaluating porting my software to Lambda or just adapting the thing to use MoonMail.

I have the following questions:

In my tests using Serverless, I noticed that when I changed a resource name (like the name of a DynamoDb table) and redeployed, there was no warning and the old table and its contents were destroyed. I think that a simple mistake like an extra character in the config file resulting in the deletion of all data on a database is pretty risky. How do you handle this kind of issue?

Regarding sending email through SES. How do you handle throttling when you reach the sending limit for a particular account? Do you do exponential backoffs? I can't seem to find this in the code base. I'll be very grateful if you could point me in the general area in the repo where this happens.

like image 633
Julian Avatar asked Jan 25 '17 20:01

Julian


People also ask

Is lambda a serverless architecture?

AWS Lambda is a serverless, event-driven compute service that lets you run code for virtually any type of application or backend service without provisioning or managing servers. You can trigger Lambda from over 200 AWS services and software as a service (SaaS) applications, and only pay for what you use.

What architecture does AWS Lambda use?

Lambda functions that use arm64 architecture (AWS Graviton2 processor) can achieve significantly better price and performance than the equivalent function running on x86_64 architecture. Consider using arm64 for compute-intensive applications such as high-performance computing, video encoding, and simulation workloads.

What is serverless framework in AWS?

Serverless Framework is open source software that builds, compiles, and packages code for serverless deployment, and then deploys the package to the cloud. With Python on AWS, for example, Serverless Framework creates the self-contained Python environment, including all dependencies.

What is serverless architecture medium?

Serverless architecture is often considered the evolution of Platform-as-a-Service. In a serverless architecture, applications either depend on third-party services known as Backend as a Service or “BaaS” or on custom code run in ephemeral containers under Function as a Service or “FaaS.”


2 Answers

  1. MoonMail has its table names stored in s-templates.json. This file is rarely touched and hence the team hasn't experienced this problem yet, but it is true that danger is still there, and I would approach AWS team with question how to avoid dropping table by simply renaming it in CF.
  2. It does retries in sending limit case with Cloud Watch invocation (MM team correct me if I am wrong, but 99% sure I am not).
like image 163
Alua K Avatar answered Sep 22 '22 10:09

Alua K


You can set DeletionPolicy: Retain when creating your DynamoDB tables to prevent them from being accidentally deleted by Cloud Formation.

If your Lambda is invoked by SNS then you could simply fail when the SES limit is exceeded. SNS would then reattempt delivery using back-offs.

like image 27
Rich Buggy Avatar answered Sep 20 '22 10:09

Rich Buggy