How to Make Your Lambda Functions Run Faster (and Cheaper)

How to Make Your Lambda Functions Run Faster (and Cheaper)

Learn how to Make Your Lambda Functions Run Faster (and Cheaper). The AWS Lambda service allows us to easily deploy and run our own code, without worrying too much about the underlying infrastructure. It essentially scales infinitely and can be connected with a bunch of other services, like API Gateway, S3, AppSync, DynamoDB, etc.

The AWS Lambda service allows us to easily deploy and run our own code, without worrying too much about the underlying infrastructure (when compared to non-serverless technologies). It essentially scales infinitely (with great power comes great responsibility), and can be connected with a bunch of other services, like API Gateway, S3, AppSync, DynamoDB, etc.

And usually, the thing people first start creating with the service are good-old HTTP APIs, like for example REST or even GraphQL. In those situations, since the actual users (potential customers) are the ones who will be invoking your Lambda functions, it's important that they are responding as fast as possible - meaning, we want to have function cold starts as short as possible, and afterward, make our code execute necessary logic in the most efficient way.

How to ensure that is the case? Well, that is the topic of this article, in which we'll cover five tips that can help you in that regard. So, without further ado, let's take a look!

1. More RAM = faster execution = same price

Allocating more RAM to a function means faster execution. That's true. But it also means you pay more, right? Well, it depends. Sometimes that's actually not true.

Consider these two  512MB RAM and  1024MB RAM Lambda function CloudWatch logs. The billed durations from the logs are also shown in the following chart:

serverless aws javascript aws-lambda graphql

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Deploying an Apollo GraphQL Application As An AWS Lambda Function Through Serverless

This article is in continuation of Deploying an Apollo GraphQL Application As An AWS Lambda Function Through Serverless. Wherein we built a minimalistic application to pull AWS DynamoDB data from a locally hosted Graphql server.

Serverless Express – Easy APIs On AWS Lambda & AWS HTTP API

Serverless Express enables you to easily host Express.js APIs on AWS Lambda and AWS HTTP API. Here is how to get started and deliver a Serverless Express.js based API with a custom domain, free SSL certificate and much more!

Adding Code to AWS Lambda, Lambda Layers, and Lambda Extensions Using Docker

Adding Code to AWS Lambda, Lambda Layers, and Lambda Extensions Using Docker. With Docker, we have three ways to add code to Lambda that isn’t directly part of our Lambda function. Try to AWS Lambda, Lambda Layers, and Lambda Extensions Using Docker.

Serverless Proxy with AWS API Gateway and AWS Lambda

Serverless Proxy with AWS API Gateway and AWS Lambda. We can communicate between Public and Private instance via a Serverless Proxy thanks to AWS Api Gateway and AWS Lambda. Github Webhook calls a Public API Gateway, API Gateway triggers a Lambda attached to VPC.

Accessing AWS DynamoDB through Apollo GraphQL Server deployed in AWS Lambda through Server

Accessing AWS DynamoDB through Apollo GraphQL Server deployed in AWS Lambda through Serverless. Objective: Fetch all records of a DynamoDB table through a GraphQL lambda function. Technologies used: AWS DynamoDB, AWS Lambda, AWS IAM, Serverless, Apollo Graphql.