Skip to content

Lambda

Obtaining caller ip address with Lambda FURLs

Steampunk villain breaking into a bank vault

If you use Lambda Function URLs and are extracting the caller's ip address from the x-forwarded-for header, that ip can be spoofed. In this article, I'll describe the scenarios where Lambda mangles this header and a workaround to get the caller's true ip address. Since several frameworks rely on the x-forwarded-for to determine the caller's ip address, your caller's ip address may be wrong!

Migrating to LLRT

Steampunk pod racer

With each release of LLRT (Low Latency Runtime for Lambda), I've tried to use it to run my production API and failed. Recently I took a different approach and navigated the last few hurdles to migrate my API from Node 22 to LLRT. In this post, I'll share how I did it, the challenges I faced, and some benchmarks.

Coldstarts with the AWS Javascript 3.502 SDK

Drift car without doors

In November 2023, I noticed Lambda coldstarts were 40 ms - 300 ms slower because they unnecessarily loaded the SSO credentials provider. I cut a GitHub issue which was closed with wontfix. Fast forward to January 29, version 3.502 of the AWS JavaScript SDK was released to lazy load non-essential credentials providers. This is a big win, but you can still squeeze out more performance. In this post I'll show you how to make your coldstarts 35 ms faster.

Totally async EventBridge

Man entering the backdoor

I'm a big fan of the CloudWatch Embedded Metrics Format. It lets you write metrics to the lambda log without the overhead of a service call. Alas, there is no Embedded EventBridge Format, you need to make a sync call to EventBridge to put events onto the bus. Can we make it more asynchronous? In this post, I'll describe a back door to publishing events to EventBridge by just writing JSON to the lambda log.

Optimizing lambda coldstarts

Lambo kicking it into 6th gear

You thought you could just set some flags and your node.js lambda function would be bundled, tree-shaken, minified and go from ice cold to glowing hot in milliseconds? My sweet summer child. I thought that too, but then I analyzed the bundle, pored over some traces and realized how wrong I was. What follows is the rabbit hole I went down to optimize my lambda coldstarts.