Bite-Sized Serverless

Learn Serverless in easy-to-digest chunks.

No subscriptions. Buy once, access forever.

General Icon

Welcome to Bite-Sized Serverless

General - Foundational (100)

Bite-Sized Serverless is a collection of articles about AWS Serverless technologies, use cases, implementation details and insights. In this article you will find details about the platform, the FAQ and general info about Bite-Sized Serverless' vision, goals and scope.

On March 25th, 2022, AWS released increased ephemeral storage for Lambda Functions. Previously limited to 512 MB, Lambda Functions can now use up to a whopping 10 GB of temporary disk space. This opens up new possibilities, like dynamically loading machine learning (ML) models for inference. In this Bite we will show how to implement ML inference in a Lambda Function, using MXNet, GluonCV, and dynamic models.

It's an open secret that the 'init' phase in AWS Lambda is free. This fact is not included in the AWS documentation, FAQ, or pricing pages, yet the Lambda Function logs clearly show the 'Init Duration' is not included in the 'Billed Duration'. At least, most of the time. This Bite will demystify when the AWS Lambda init duration is free, and when it is billed.

Asynchronous Lambda Functions process events without providing direct feedback to the caller. To maximize the chance of successful processing, the Lambda Function can retry the event in case of failure. However, the default failure handler only supports up to two retries and no jitter. In this post we'll implement a custom retry handler with exponential backoff, full jitter, and delays up to 12 hours.

Priority Queues offer a fast-lane for important messages. In this post we will show how to implement the Priority Queue pattern with SQS and Lambda.

CloudFormation Icon

CFN Custom Resources backed by Step Functions

CloudFormation - Advanced (300)

CloudFormation Custom Resources are a powerful mechanism to run arbitrary code as part of a CloudFormation deployment. They can be used to create, update and delete resources without CloudFormation coverage, to notify or synchronize external systems when a deployment occurs, or to call any AWS or third-party API. Natively, Custom Resources can only be implemented using SNS or Lambda Functions. In this Bite we will implement a Custom Resource backed by a Step Functions State Machine.

As your applications become more serverless, you will find that your classic testing strategies no longer suffice. Unit tests don't cover services like IAM, and end-to-end tests aren't granular enough. Integration tests are a natural fit to cover the gap, as a significant chunk of your application now consists of integrations between native services. In this Bite we will cover how Step Functions can be used to run comprehensive integration tests on your serverless environments.

CloudFront Icon

Cache Control with CloudFront Functions

CloudFront - Advanced (300)

Asset caching is an essential component for fast and efficient websites. Caching allows browsers and content distribution networks (CDNs) to locally store a copy of an asset, such as an image or a javascript file. The next time a user requests the same asset, it can be served from the local cache instead of the origin. This improves loading speed and user experience, while reducing stress on the origin. In this Bite we will cover how we can configure and instruct our CDNs and browsers to optimally cache our assets. We will use CloudFront behaviors to configure the CDN and CloudFront Functions to add HTTP caching headers.

At Re:Invent 2021, AWS announced that events streamed from DynamoDB to Lambda Functions can now be filtered at the source. This allows us to build cleaner, more efficient and more cost-effective solutions. This feature is powered by Event Source Mappings, the invisible engine converting streams and queues to batches. In this Bite we will dive deep on Event Source Mappings and its filtering capabilities.

Amazon Simple Queue Service (SQS) is the oldest AWS service. SQS was released in beta in 2004, and although the core functionality has remained the same, many features and integrations have been added since. They include Dead Letter Queues, long polling, larger payloads, and Lambda Event Source Mappings. Some of these features introduce new, and sometimes surprising, ways for a message to disappear. In this Bite we will look at nine ways a message can be removed from a queue.

Cognito User Pools are fully managed user directories for your web and mobile apps. In Cognito's default configuration it requires users to confirm their identity through a valid email address or phone number. In this Bite we will use Cognito Lambda Triggers to avoid personally identifiable information (PII) altogether, allowing for completely anonymous user sign-ups.

S3 Buckets can be configured to stream their objects' events to the default EventBridge Bus. This is an on-or-off toggle per Bucket. When multiple buckets have EventBridge notifications enabled, they will all send their events to the same Event Bus. In this Bite, we will use this to respond to events across multiple S3 Buckets.

Lambda Icon

Lambda Cold Starts and Bootstrap Code

Lambda - Intermediate (200)

In this Bite we will dive into AWS Lambda cold starts, the difference between initialization and handler code, and the undocumented bootstrap performance boost.

DynamoDB does not support auto-incrementing IDs for items. They can be a performance bottleneck at scale, and most workloads are better off with UUIDs anyway. However, there are use cases where auto-incrementing integers are required. In this Bite we will use DynamoDB Transactions, Conditions, and Atomic Counters to achieve reliable auto-incrementing IDs at any scale.

CloudFront Icon

The Anatomy of a CloudFront Distribution

CloudFront - Intermediate (200)

To the casual observer, CloudFront might seem like a single layer of cache locations. In this Bite we will explore its deeper layers: its points-of-presence, regional edges, origin shields, Lambda@Edge and CloudFront functions.

General Icon

Introduction to Event-Driven Architectures

General - Foundational (100)

Event-Driven Architectures and Serverless go hand in hand. In this bite we will cover the concepts and principles of Event-Driven architectures, the benefits they unlock and the caveats to be aware of.

Designing applications in an event-driven architecture requires a different way of thinking. Instead of interfaces and response times you'll find yourself designing message formats and fan-out systems. In this Bite we will cover the basic principles for event driven-architectures, including loose coupling, scaling, minimal responsibilities and real-time processing.