AWS Lambda and no servers

    For me personally, Amazon Web Services has always been associated with Infrastructure as a Service (IaaS), on the basis of which everyone built their services and applications. But there are also claiming to be a platform in the form of a service, for example, Elastic Beanstalk and OpsWorks. Although, in my opinion, PaaS can be considered a stretch of them, since access to the infrastructure remains, and at the same time a headache for its administration.

    The whole charm of PaaS is its zero administration costs, ease of use and, as a result, the ability to focus on the application code, forgetting how to deploy, integrate and maintain it.

    So, according to representatives of AWS, Lambda will allow you to forget about the infrastructure and run applications in the cloud, while getting integration with other Amazon services, scalability, low cost of using computing resources. All you need to start is to write a function, associate it with events. After that, Amazon will automatically perform the function with each new event. You should not think about scaling and high availability: our function will be able to process tens of thousands of requests per hour without any efforts on our part, without a backend in its traditional sense.


    The main workhorse is the lambda function (or lambda expression ). A lambda function is associated with a context:
    • Environment: PL, amount of RAM, access settings
    • Resources whose changes you want to track
    • Code is the same function that is executed when a resource change message is received.

    How it works

    When a resource is changed, a message is generated that activates the function. In turn, it (the function) has access to the JSON object, which contains all the necessary information about this change, or about another message.

    For example, we can associate a function with an s3-bucket. When a new object hits it, our lambda will be launched and gain access to data about it. Let's say this is a new image for which you need to make a set of sketches of different sizes. Our function will be launched with every new image loaded into the bucket, and we can save the result in the same or separate bucket.

    It must be remembered that our function does not save its state (stateless), so the results of the work need to be stored in some kind of data warehouse. In our example, this is an S3 bucket.


    Only JavaScript + Node, js is currently supported. You can also download libraries and use the AWS SDK. As I understand it from the video presentation, under the hood, Docker is used, running on an EC2 instance.

    Current Limitations and Future Plans

    The first thing caught my eye:
    • lack of finished CI / CD
    • no integration with version control systems (git, svn)

    Also, as mentioned above, only JavaScript is supported, as a programming language.

    The plans are to expand the list of supported services (now S3, DynamoDB and Amazon Kinesis) and increase the number of supported PLs.


    This service is paid according to two parameters: the number of requests and their total execution time, taking into account the consumed memory.

    Number of Inquiries

    • first million requests per month - free
    • anything beyond this limit is $ 0.20 per 1 million requests ($ 0.0000002 per request)

    Total query execution time

    • start time is considered from the start of the function to the return of the result, or to stop by timeout (set for each function)
    • time is rounded up to the nearest multiple of 100 ms
    • the cost of each second depends on the amount of allocated memory, i.e. $ 0.00001667 for every Gigabyte-second

    As usual, AWS provides a free period (free tier). More information about prices can be found here . There are several examples there. I will give one of them.
    If the execution time of the function is 1 second, and it will be launched 3 million times during the month, then we will get an account of $ 18.34.

    Related Links

    Official Blog
    Service Start Page


    AWS Lambda is in the "preview" stage, in order to register and gain access, you must fill out the request by link . Considering the very good free tier, a try is worth it. If there is time, then I will definitely share practical experience of use.

    Also popular now: