First, a few assumptions:
Serverless infrastructure “allows you to build and run applications and services without thinking about servers.” (https://aws.amazon.com/serverless/). In most cases, your code is deployed into a container which is stateless, lasts only as long as your code is running, and is fully managed by a third party. This means, if you have a script to generate a thumbnail from a given full size image, you simply tell your infrastructure provider that the script is written in Python and then fire a request to the script. They take care of the rest and you only pay for the server while the script is actually running. In this way, serverless architecture can makes the traditional “pay for what you use” model of the cloud even more precise.