<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mark Sailes on Medium]]></title>
        <description><![CDATA[Stories by Mark Sailes on Medium]]></description>
        <link>https://medium.com/@mark-sailes?source=rss-5d657e1594e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*yerThYWSSlt9XuyX8e7kow.jpeg</url>
            <title>Stories by Mark Sailes on Medium</title>
            <link>https://medium.com/@mark-sailes?source=rss-5d657e1594e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 01 Jun 2026 02:17:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mark-sailes/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[The Other Feature of AWS Lambda Provisioned Concurrency — Saving Money]]></title>
            <link>https://mark-sailes.medium.com/the-other-feature-of-aws-lambda-provisioned-concurrency-saving-money-24e4e5086e1b?source=rss-5d657e1594e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/24e4e5086e1b</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[cost-optimization]]></category>
            <dc:creator><![CDATA[Mark Sailes]]></dc:creator>
            <pubDate>Fri, 16 Apr 2021 05:42:08 GMT</pubDate>
            <atom:updated>2021-04-16T05:42:08.347Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4Y8rxgG5seDWIe1GsJ0zQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Luke Chesser</a> on <a href="https://unsplash.com/s/photos/chart?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>The Other Feature of AWS Lambda Provisioned Concurrency — Saving Money</h3><p>Provisioned concurrency was launched in December 2019 and its primary feature is to enable workloads which require highly consistent latency. It does this by provisioning a configurable amount of AWS Lambda execution environments ready for your function to use at any point. This is different to regular usage where your function will experience a cold start if its concurrency increases from its current value. This functionality and its performance benefits are presented in the AWS Blog <a href="https://aws.amazon.com/blogs/aws/new-provisioned-concurrency-for-lambda-functions/">Provisioned Concurrency for Lambda Functions.</a></p><p>In this blog post we’ll look at the lesser known benefit of provisioned concurrency, how it also saves you money. Modern day builders have an increasingly long list of technology they need to know about, and yes I’m also suggesting they should learn about the cost implications of their architectures. In most cases builders will be building systems for a business and the thing you build will have a value. Understanding the cost of producing and running that thing is important and will ultimately make you a better builder.</p><p>So lets dive in. Lambda is billed on two components, requests and duration. Requests are the number of individual invocations made to your function, however they are called. This could be in response to a API Gateway request, an SQS message, it doesn’t matter. Each invocation no matter the source is billed the same. Duration is how many GB/s are used. Using 1024 MB of memory for 1 second is billed at the same price as using 512 MB of memory for 2 seconds.</p><p>In my local region EU-WEST-1 (Ireland) these are the current Lambda prices as of the time of writing.</p><p><strong>Regular Billing</strong></p><p>Requests $0.20 per 1M requests</p><p>Duration $0.0000166667 for every GB-second</p><p><strong>Provisioned Concurrency</strong> is billed slightly differently, it has 3 components. Requests and duration are the same as regularly billing. Provisioned concurrency also has a set fee for each GB-second you reserve. This is charged whether you use it or not.</p><p>Provisioned Concurrency $0.000004646 for every GB-second</p><p>Requests $0.20 per 1M requests</p><p>Duration $0.0000108407 for every GB-second</p><p>These values are so small it’s hard to comprehend, at least for me. But if you add up the two GB-second values of provisioned concurrency it equals about 7% less than the normal billing. However you will only get this saving if your provisioned concurrency period is equal to your function duration. <strong>Which means</strong> <strong>if you’re using the capacity you’ve requested, the billing for that capacity will be less. If you don’t use it, you pay a premium for having it ready and waiting.</strong></p><p>So how do I translate this knowledge into saving money for my workload? With most workloads there will be a tipping point at which the reduced cost of provisioned concurrency is countered by periods when provisioned concurrency isn’t fully used. How and when this point is reached will be dependent on the traffic pattern and the amount of concurrency provisioned. The way to skip this complexity is to configure provisioned currency to your lowest level of concurrency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ium34SZUOtra4y_M1SH9Yg.jpeg" /><figcaption>photo by Author (Mark Sailes)</figcaption></figure><p>If your traffic profile has periods of complete inactivity then you will most likely not benefit from this as a cost saving mechanism. If you have a more consistent traffic pattern, it will probably be the case that you benefit more.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xnSRk7mJgArmq3YtR95a0Q.jpeg" /><figcaption>photo by Author (Mark Sailes)</figcaption></figure><p>For full details of provisioned concurrency read the <a href="https://aws.amazon.com/lambda/pricing/">Lambda pricing</a> page.</p><p><strong>A note on premature optimizations.</strong> I’ve seen entire startups running very successfully spending less than $100 on Lambda a month. Unless you’re using Lambda to a very high volume the discussion of whether to implement this change could cost more than the savings it brings. Sanity check your workload first. Remember also that if you use this as a cost optimization mechanism, you will also receive the more consistent performance profile for the concurrency you reserve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24e4e5086e1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better application logging on AWS Lambda]]></title>
            <link>https://mark-sailes.medium.com/better-application-logging-on-aws-lambda-68524236fc43?source=rss-5d657e1594e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/68524236fc43</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[observability]]></category>
            <dc:creator><![CDATA[Mark Sailes]]></dc:creator>
            <pubDate>Wed, 14 Apr 2021 21:36:49 GMT</pubDate>
            <atom:updated>2021-04-14T21:36:49.456Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ujFgi1dY28fzswfCRicQHQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@sigmund?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Sigmund</a> on <a href="https://unsplash.com/s/photos/code-logs?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In this post I will cover what I consider the best practices for producing useful logs when deploying to AWS Lambda. I’ll explain how AWS Lambda Powertools, an Open-source client library, can help do a lot of the heavy lifting for you. This post is aimed at developers, DevOps engineers and anyone else involved in the production or operation of systems using Lambda.</p><p>I started my tech career as a build engineer; I guess we’d call this a junior Ops role now. It was my responsibility to build other people’s code, get it onto the servers and understand if it wasn’t working correctly. You can imagine that logs of every kind became integral to my working life. Ant, Maven, Hudson (now Jenkins), WebLogic, Tomcat, all produced logs and could be a source of information on issues affecting the applications I supported.</p><p>Fast forward to today and although the build and continuous integration tooling has changed over time, the biggest difference I’ve seen is with application logs. I used to deploy applications to two servers in production and one server in the dev and test environments. I used to know all the server ip addresses by heart and had scripts to help me with common tasks. Working on a single server most of the time made life simple. If I had a problem, connect to the machine over ssh, grep the application log for ERROR and start debugging. I can’t tell you how many times I went to the first production server, did the same, found nothing and scratched my head, only to then remember I needed to check the second machine. So what does this have to do with AWS Lambda?</p><p>Well as a user of Lambda I have no idea what server my code is running on or what is happening with my application logs. It turns out both of these are huge advantages. The placement of my code onto a server spread across multiple availability zones, load balanced automatically and health checked is all work I no longer have to do. Zipping log files, shipping them to a central location and managing storage is no longer a pain for me.</p><p>Lambda automatically integrates with Amazon CloudWatch for a fully managed logging solution which makes working with ephemeral execution environments easy. As an application developer all I have to do is produce my log message to standard out and Lambda does the rest. So in this new world what are the best practices when producing application logs?</p><p><strong>Include </strong><a href="https://docs.aws.amazon.com/lambda/latest/dg/java-context.html"><strong>Lambda context</strong></a><strong> information.</strong> The function name, its memory allocation, its version is all useful information to help debug problems. Has a problem started after a new version has been released? Did the function get more expensive after a memory allocation change?</p><p><strong>Include AWS Identifiers. </strong>As well as the AWS request ID, include the X-Ray trace id if you have tracing enabled. Help yourself join information for multiple sources by including all the IDs you’ll need. This is also true for IDs for external or integration systems.</p><p><strong>Structure your logs in JSON.</strong> Take advantage of the powerful querying in <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AnalyzingLogData.html">CloudWatch Insights</a> by structuring your logs into JSON.</p><p><strong>Log requests and responses. </strong>Where the workload allows, log requests to and responses from your function. This isn’t always possible if you’re working with particularly big requests such as encode images.</p><p><strong>Include business identifiers.</strong> If the log message is about a customer, include the customer ID. If the log message is about a transaction failure, include the transaction ID.</p><p><strong>Runtime configurability.</strong> Have the ability to change your logging level and sampling without having to re-release your function code. The ability to enable and disable DEBUG logging when you have a problem is fantastic. Since CloudWatch charges are based on amount ingested as well as storage it is a good cost optimization do be able to control both easily.</p><p>This may all sound like a lot of additional work and it can be, but AWS Lambda Powertools supports all of the functionality I listed above and more. Powertools currently supports <a href="https://awslabs.github.io/aws-lambda-powertools-java/core/logging/">Java</a> and <a href="https://awslabs.github.io/aws-lambda-powertools-python/core/logger/">Python</a>, with more language support coming.</p><p>For examples of Java Lambda function handlers and the log messages they produce, you can read the <a href="https://aws.amazon.com/blogs/opensource/simplifying-serverless-best-practices-with-aws-lambda-powertools-java/">AWS blog post</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=68524236fc43" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create custom business metrics for your Lambda functions]]></title>
            <link>https://mark-sailes.medium.com/create-custom-business-metrics-for-your-lambda-functions-152628b4aa5?source=rss-5d657e1594e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/152628b4aa5</guid>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[observability]]></category>
            <dc:creator><![CDATA[Mark Sailes]]></dc:creator>
            <pubDate>Tue, 13 Apr 2021 20:31:21 GMT</pubDate>
            <atom:updated>2021-04-13T20:31:21.831Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eVj9bCkqK2hX08hI_xsqUg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markuswinkler?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Winkler</a> on <a href="https://unsplash.com/s/photos/graphs?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>By default AWS Lambda creates a number of <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-metrics.html">default metrics about your function</a>. These include errors, throttles, duration, concurrency and many more. These are all metrics which can be produced about your function without knowing anything about what your function does. When you want to create your own custom metrics you have a few choices. In this post I will talk about the various ways you can integrate with Amazon CloudWatch including what I think is best practice for working with Lambda.</p><p>Firstly, why would you want to create your own custom metrics? In most cases there is information about your function which is important to the business process it is part of. For example recording that a purchase has been made, a seat has been allocated, a booking cancelled, or that any of these were attempted and failed. As your system grows it’s important to develop useful metrics which can be used to monitor the health of your system and business.</p><p>If you’re already using AWS Lambda you’ll most likely be aware of the benefits of managed services. Amazon CloudWatch is a fully managed service which provides many monitoring capabilities, metrics being just one. Developers who are familiar with CloudWatch and who have worked on other compute services might use the CloudWatch PutMetricData API to record a single custom metric.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*ib5hj_XIZ9CsP92GyTroNw.png" /></figure><p>This will absolutely work, but isn’t ideal for Lambda. Because this API call is synchronous and Lambda is billed in part by the duration of each execution, you will be paying Lambda costs while your PutMetricData API call is being processed. This can be further exacerbated if you are making multiple PutMetricData calls for each function request. <em>This can be simplified by batching your metrics into a single API call.</em></p><p>A better way is to use <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Specification.html">CloudWatch Embedded Metrics Format</a> (EMF). EMF doesn’t make an API call to CloudWatch, instead it produces a JSON object describing your metric and outputs it to standard out. As you probably know, all logs produced to standard out are shipped to CloudWatch. CloudWatch knows to look for JSON objects conforming to the EMF standard and creates metrics on your behalf. This has the advantage of being entirely asynchronous. Low level <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch_Embedded_Metric_Format_Libraries.html">EMF client libraries</a> are available in Node.js, Python, Java and C#.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*vv_RSHPdpR4F1-eJJDRXUQ.png" /></figure><p>The Open-Source Lambda Powertools project has higher level clients which help your interact with EMF more easily. Lambda Powertools are currently available for <a href="https://awslabs.github.io/aws-lambda-powertools-java/">Java</a> and <a href="https://awslabs.github.io/aws-lambda-powertools-python/">Python</a>, with more language support on the way.</p><p>Before we look at some examples, let’s recap on some of the CloudWatch terms to make sure we understand what the Lambda Powertools functionality is doing. CloudWatch allows you to distinguish between your metrics in a number of ways, the highest level being the namespace. Each namespace can have multiple dimensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*O2PbDUq86GfJXULVv9OhFg.png" /><figcaption>aws-lambda-powertools-java metrics — <a href="https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/#terminologies">Terminology</a></figcaption></figure><p>In the diagram an example is given of an ‘e-commerce-app’ being the namespace and highest level item. Then three dimensions representing other distinct aspects of that functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dkmdjSup6Cl0LapWHonsXg.png" /><figcaption>aws-lambda-powertools-java metrics — <a href="https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/#creating-metrics">Creating Metrics</a></figcaption></figure><p>In this example we use the @Metrics annotations to make this handler Powertools metrics enabled. We can use the annotation variables to set the namespace and a dimension reducing the amount of duplicated code. You can then get access to the low level MetricsLogger using the MetricsUtils Powertools class and record metrics using the putMetric method. Behind the scenes Powertools is validating, serializing and flushing your metrics just before the handler method returns.</p><p>Lambda Powertools can help you to record cold starts automatically using another variable within the annotation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8yXRqekNn89pfdDdXT0MUg.png" /><figcaption>aws-lambda-powertools-java metrics — <a href="https://awslabs.github.io/aws-lambda-powertools-java/core/metrics/#capturing-cold-start-metric">Capturing cold starts metric</a></figcaption></figure><p>For more information about Powertools visit the <a href="https://awslabs.github.io/aws-lambda-powertools-java/">documentation pages</a>. You’ll find instructions on how to add it to your project.</p><p>Notes on cost.</p><p>Using the synchronous PutMetricData API call to CloudWatch is charged at $0.01 per 1000 requests.</p><p>EMF is free, but you will incur more cost for ingesting log data, this is charged at $0.50 per GB.</p><p>Both methods will incur costs for custom metrics at $0.30 per metric/month.</p><p>Detailed pricing information can be found on the <a href="https://aws.amazon.com/cloudwatch/pricing/">CloudWatch pricing</a> page.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=152628b4aa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lambda concurrency and why you don’t need a warmer]]></title>
            <link>https://mark-sailes.medium.com/lambda-concurrency-and-why-you-dont-need-a-warmer-d9da6e205782?source=rss-5d657e1594e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9da6e205782</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[cold-start]]></category>
            <category><![CDATA[horizontal-scaling]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Mark Sailes]]></dc:creator>
            <pubDate>Sun, 11 Apr 2021 18:52:09 GMT</pubDate>
            <atom:updated>2021-04-11T19:10:02.585Z</atom:updated>
            <content:encoded><![CDATA[<h3>AWS Lambda concurrency and why you don’t need a warmer</h3><figure><img alt="Photo by &lt;a href=”https://unsplash.com/@nubelsondev?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText&quot;&gt;Nubelson Fernandes&lt;/a&gt; on &lt;a href=”https://unsplash.com/t/technology?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText&quot;&gt;Unsplash&lt;/a&gt;" src="https://cdn-images-1.medium.com/max/1024/1*6AxpZDT0OjE-KiZIdm2_Nw.jpeg" /></figure><p>One of the most common questions I’m asked as an AWS Solutions Architect is how do I avoid AWS Lambda cold starts, and should I use some mechanism for warming Lambda functions. This post is aimed at developers / DevOps engineers new to Lambda. Hopefully, by the end of it, you’ll understand the Lambda concurrency model and why warming functions are in virtually all cases not required, or of little real benefit.</p><p>The Lambda concurrency model is probably very different to what you’re used to if you’ve come from containers, VMs or bare metal. The latter handle multiple threads of execution at any time. Lambda functions operate in a different way. Only one invocation is handled by a single instance of a Lambda function at any one time. A Lambda instance sometimes referred to as an execution environment or a sandbox is a dedicated <a href="https://firecracker-microvm.github.io/">microVM</a>. These microVMs are incredibly fast to start up and give each owner <a href="https://docs.aws.amazon.com/whitepapers/latest/security-overview-aws-lambda/lambda-isolation-technologies.html">strong security</a> around where and how their code is being executed.</p><p>So each Lambda function can be made up of thousands of microVMs all executing the same code base, working on different requests. A fleet of instances all managed by the Lambda service on your behalf.</p><p>It’s the Lambda service’s responsibility to make sure that each invocation of your function is executed as fast as possible. If all the current instances are busy with work, then the Lambda service will instruct a new microVM to start up, copy your code to it and get it ready to handle the waiting request. This process of provisioning a new microVM is called a cold start. When a microVM is not handling a request it isn’t automatically shut down. The Lambda service expects more requests to come, so it keeps instances around for a period of time. If these instances aren’t being kept busy they are shut down. When a request comes to an instance which is idle but ready, this is called a warm start. The instance is up and has all your code ready to go.</p><p>Cold starts are slower than warm starts. Although microVMs are quick to start up, each step in the process adds a small amount of time and there will always be a difference between them. In some workloads latency is very important, user-facing websites for example. You want to do everything you can to minimize the effects of cold starts. That is a topic for a very long post of which I’m sure there are many in existence already. There are also a number of posts that recommend mechanisms to warm Lambda functions. This is done by injecting synthetic requests into the Lambda function which aren’t from users, in order for those synthetic requests to hit cold starts and thereafter users to hit warm starts.</p><p>Unfortunately, it’s not that simple.</p><p>The most common warming mechanisms I see are ones that use CloudWatch scheduled events to trigger a Lambda function every 15 minutes. This will start one Lambda instance, we call this having a concurrency of 1. After the synthetic execution has finished the instance will be available for reuse by any other requests. If a request comes in while the instance is executing another request, then the Lambda service will create a new instance, a cold start and the concurrency will be 2. The warming mechanism hasn’t prevented the second cold start. Simple synthetic traffic generators like this won’t prevent cold starts <strong>above the level of concurrency which they themselves generate</strong>. Now you absolutely could create a sophisticated synthetic traffic generation mechanism, but it’s going to be, in my opinion, more effort than it’s worth. <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html">Lambda handles scaling</a> quickly and effectively so you don’t have to.</p><p>The exceptions to this are if you have a very low traffic volume and the value of each execution is high. In this case, it might be worth spending the time and effort into creating a warming mechanism. For the majority of workloads that have unpredictable traffic, warming mechanisms won’t have the effect you want them to have.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9da6e205782" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Opening sourcing the AWS Java Runtime Interface Client]]></title>
            <link>https://mark-sailes.medium.com/opening-sourcing-the-aws-java-runtime-interface-client-144ecdb70671?source=rss-5d657e1594e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/144ecdb70671</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Mark Sailes]]></dc:creator>
            <pubDate>Mon, 05 Apr 2021 11:36:17 GMT</pubDate>
            <atom:updated>2021-04-05T18:18:43.488Z</atom:updated>
            <content:encoded><![CDATA[<h3>Open-sourcing the AWS Java Runtime Interface Client</h3><p>At re:Invent 2020 a new packaging format for AWS Lambda functions was introduced; container images. With this functionality came a number of managed base images that customers can use too. They are patched and maintained by AWS and include functionality to simplify running your functions in a container image.</p><p>So what is that functionality? It’s an implementation of the <a href="https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html">Lambda runtime API</a>. This isn’t just for containers, it’s just that with the introduction of this feature, the runtime API has a lot more visibility. You could always use this API to run other languages such as PHP or R.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*le5iNIUKh7kSvVGw1MebRg.png" /></figure><p>So let&#39;s dive a little deeper and look at what was open-sourced and why it’s important to developers and builders.</p><p>Firstly there is the <a href="https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-runtime-interface-client">aws-lambda-java-runtime-interface-client</a> (RIC) this is the implementation of the polling client which asks for the next invocation to execute. In a managed environment it knows which handler to execute through the configuration you’ve given. With container packaging, you can specify the handler in the CMD. The RIC uses a native binding to use CURL to make the required API calls. This reduces the latency compared to Java HTTP clients. It also handles all of the weird and wonderful ways in which a customer’s function can error and handles them gracefully.</p><p>By open-sourcing this library, AWS has shared a battle-hardened, highly optimized component for others to use. Digging deeper into the RIC, it actually helps even more. Lambda functions are triggered by a vast variety of different event sources, created by different AWS teams. They all produce their events differently and the Lambda service has to handle these. For the Java managed runtime additional work is done to make sure that these events are presented in the best way possible for developers in the form of the <a href="https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-events">aws-lambda-java-events</a> library. Java POJOs for most of the event sources are included. Occasionally there is clean up required to make these event sources match typical Java naming standards. This work is done in the <a href="https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-serialization">aws-lambda-java-serialization</a> library.</p><p>This behind the scenes transform has caused confusion in the past when developers have been writing unit tests for their functions. They would make an event with certain conditions and then fire it through the handler and assert certain reactions. The problems came when the events weren’t transformed by the tests, leading to a serialization error. Open sourcing the serialization library made unit testing much simpler and easier with the introduction of the <a href="https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-tests">aws-lambda-java-tests</a>. It includes support for any required serialization of your events and handy ways to load your test events from files.</p><p>My hope is that other open-source frameworks such as <a href="https://quarkus.io/">Quarkus</a>, <a href="https://micronaut.io/">Micronaut</a> and <a href="https://spring.io/blog/2021/03/11/announcing-spring-native-beta">Spring Native</a> will use these libraries to improve their own Lambda functionality. I also hope that it will drive new innovation in this area.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=144ecdb70671" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>