TL;DR: Allocate to your function as much memory as your wallet can allow.

Why? Well, then read below.

A Story About My Impatience

I needed 2 functions to make several HTTP requests and HTML parsing.

Microservice? Overkill and boring. It’s 2016. Let’s go for Lambda.

The next where people usually go after Landing Page is Pricing Section. And so did I:

The table below shows the approximate price per 100ms associated for different memory sizes.

The list continues down to 1536 MB. My thoughts at that moment were:

Cool, my code requires only ~50 MB of memory to work. I can start with the cheapest plan. I’m going to save a whole bunch of money!

Wrong.

But I didn’t know that yet. There is no mention about provided CPU resources, so I assumed it’s already high enough. Maybe those top memory options are intended for Java? 😅

A Misleading?

I thought Lambda is perfect for short CPU-intensive tasks. Why not, when the first official tutorial describes creating thumbnails from images using ImageMagick? What else if not image resizing can eat all your CPU?