<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html" version="2.0">
  <!-- Source: https://medium.com/@hvdschaaf/feed -->
  <channel>
    <title><![CDATA[Stories by Haiko van der Schaaf on Medium]]></title>
    <description><![CDATA[Stories by Haiko van der Schaaf on Medium]]></description>
    <link>https://siftrss.com/f/rqA5N6JXZDo</link>
    <image>
      <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dfXYtc4Yo4qn6gzN.</url>
      <title>Stories by Haiko van der Schaaf on Medium</title>
      <link>https://medium.com/@hvdschaaf?source=rss-a9f2f75ff5f6------2</link>
    </image>
    <generator>Medium</generator>
    <lastBuildDate>Sat, 09 May 2026 03:52:25 GMT</lastBuildDate>
    <atom:link href="https://siftrss.com/f/rqA5N6JXZDo" rel="self" type="application/rss+xml"/>
    <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
    <atom:link href="http://medium.superfeedr.com" rel="hub"/>
    <item>
      <title><![CDATA[Switching to Open Source Serverless]]></title>
      <link>https://medium.com/@hvdschaaf/switching-to-open-source-serverless-759045089a89?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/759045089a89</guid>
      <category><![CDATA[oss-serverless]]></category>
      <category><![CDATA[serverless]]></category>
      <category><![CDATA[open-source]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Fri, 28 Feb 2025 15:19:23 GMT</pubDate>
      <atom:updated>2025-10-15T07:00:51.816Z</atom:updated>
      <content:encoded><![CDATA[<p>Migrating from Serverless Framework to oss-serverless</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YKTEqa3tM-gAo5vd" /><figcaption>Photo by <a href="https://unsplash.com/@sebastiengoldberg?utm_source=medium&amp;utm_medium=referral">Sébastien Goldberg</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Serverless computing has revolutionized cloud development, enabling developers to build and deploy applications without managing infrastructure. The <strong>Serverless Framework</strong> has been a popular choice for deploying serverless applications, but its current shift towards a more commercial model has left many developers searching for an <strong>open-source</strong> alternative.</p><p>Enter <a href="https://github.com/oss-serverless"><strong>OSS-Serverless</strong></a> — a <strong>fully open-source</strong> alternative that ensures continuity, transparency, and freedom from vendor lock-in. In this guide, we’ll explore how to migrate your existing projects from the Serverless Framework to OSS-Serverless. We will create a project from a serverless template and generate a starter project.</p><blockquote><em>The complete project for this article can be found on Github </em><a href="https://github.com/cyberworkz/examples"><em>https://github.com/cyberworkz/examples</em></a><em> in the online-library-oss folder.</em></blockquote><h3>What is oss-serverless?</h3><p>OSS-Serverless is a maintained alternative to <a href="https://github.com/serverless/serverless">Serverless Framework</a> v3. It exists for those that cannot upgrade to Serverless Framework v4 and is a drop-in replacement for v3. The repository has been created and is maintained by <a href="https://bref.sh/">Bref</a> maintainers and contributors.</p><h3>Why switch to oss-serverless?</h3><p>The Serverless Framework was once a go-to tool for serverless development, but recent shifts, such as increased reliance on paid plans, have pushed developers towards open alternatives. <strong>OSS-Serverless</strong> offers:</p><p>✅ <strong>100% Open Source</strong> — No hidden fees, subscriptions, or commercial restrictions.<br>✅ <strong>Continuity &amp; Community-Driven</strong> — Developed and maintained by the community, ensuring long-term stability.<br>✅ <strong>Compatible with AWS </strong>— Similar syntax to Serverless Framework, making migration easy.<br>✅ <strong>No Vendor Lock-In</strong> — Deploy anywhere without being tied to a proprietary service.</p><h3>Plugins</h3><p>Testing oss-serverless with the following plugins worked just fine:</p><ul><li>serverless-plugin-typescript</li><li>serverless-plugin-optimize</li><li>serverless-offline</li><li>serverless-stage-manager</li></ul><p>This gives the impression that the serverless plugins also work out-of-the-box with oss-serverless.</p><h3>Installing OSS-Serverless</h3><p>Getting started with OSS-Serverless is simple. First, remove the Serverless Framework and then install oss-serverless globally using npm:</p><pre>npm remove -g serverless<br>npm install -g osls<br><br>serverless --version</pre><p>That&#39;s it!</p><h3>Creating a project</h3><p>To create your project we are going to use an opinionated template from the following repository: <a href="https://github.com/cyberworkz/serverless-templates">https://github.com/cyberworkz/serverless-templates</a></p><p>Use the following command to create your Serverless project:</p><pre>sls create --template-url https://github.com/cyberworkz/serverless-templates/tree/main/aws-nodejs-typescript-restapi-nest --path online-library-oss</pre><p>When you navigate into the project folder you would see the following structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/0*Wou_IES6MYDiSETr.png" /></figure><p>Open a terminal window in the project folder and run first <strong><em>‘npm install’</em></strong> to install the necessary packages. Then in the same terminal run the following command:</p><pre>npm run start</pre><p>This will run your project using the serverless-offline plugin locally. This will start a REST API Serverless function locally. Navigate in a browser window to the following URL: <a href="http://localhost:3000/dev/hello">http://localhost:3000/dev/hello </a>and you are greeted with the well-known ‘Hello World’ ;-)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*HK_dglS7wBP_NuR3.jpeg" /></figure><p>You successfully switched to oss-serverless and can create serverless projects without worrying about commercial stuff.</p><p>So, this wraps it up. I hope this helps you in your Serverless journeys. Again, the code for this project can be found on Github 👇 <a href="https://github.com/cyberworkz/examples">https://github.com/cyberworkz/examples</a> in the online-library-oss folder.</p><h3>Haiko van der Schaaf</h3><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏</li><li><strong><em>Follow me</em></strong><em> on </em><a href="https://bsky.app/profile/serverlesscorner.com"><strong><em>Bluesky</em></strong></a><strong><em> </em></strong><a href="https://bsky.app/profile/serverlesscorner.com"><strong>🦋</strong></a> <em>for my latest content about serverless technology!</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=759045089a89" width="1" height="1" alt="">]]></content:encoded>
    </item>
    <item>
      <title><![CDATA[AWS DynamoDB made easy]]></title>
      <link>https://medium.com/@hvdschaaf/aws-dynamodb-made-easy-5b6db5c0c6ba?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/5b6db5c0c6ba</guid>
      <category><![CDATA[aws-dynamodb]]></category>
      <category><![CDATA[dynamodb]]></category>
      <category><![CDATA[serverless]]></category>
      <category><![CDATA[aws-sdk-v3]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Tue, 02 Jan 2024 20:32:02 GMT</pubDate>
      <atom:updated>2024-01-02T20:56:03.881Z</atom:updated>
      <content:encoded><![CDATA[<h4>Simplify your DynamoDB Typescript code with DynamoDB Entity store</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IGzcgC_jaTV_CPig" /><figcaption>Photo by <a href="https://unsplash.com/@jeremybishop?utm_source=medium&amp;utm_medium=referral">Jeremy Bishop</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>DynamoDB is a great serverless option for persisting data. However, the AWS SDK for DynamoDB is a low-level API that unfortunately forces you to scatter information about your entities across your code. It is a maintenance nightmare. But looking a bit further than the AWS SDK, things are better.</p><p>The migration of code from AWS SDK v2 for DynamoDB to the rather unimpressive new version V3 gave me the motivation to investigate alternatives. Such an alternative should allow for writing cleaner code while not hiding all the features of DynamoDB. Long story short, I ended up with the <a href="https://github.com/symphoniacloud/dynamodb-entity-store">DynamoDB Entity Store</a>. This library embraces the &#39;<a href="https://blog.devgenius.io/how-to-do-single-table-design-with-dynamodb-db9101a43277">Single Table Design</a>&#39; approach, offers a clean interface for read operations, and has sensible defaults to protect you from unintentional costly operations such as scanning your table.</p><p>In this story, I would like to introduce the &#39;DynamoDB Entity Store&#39; library and show how it can give you cleaner code and simplify things so you can decide whether it adds value for you. To demonstrate the concepts of the library, I will use the example of an online library service used in my previous <a href="https://blog.devgenius.io/how-to-build-a-serverless-rest-api-with-nestjs-and-dynamodb-7b58b5b59bf6">stories</a>. The code for this project can be found on Github👇 <a href="https://github.com/cyberworkz/examples">https://github.com/cyberworkz/examples</a> in the ddb-entity-storefolder.</p><h4>💡DynamoDB Entity Store concepts</h4><p>The main concept of the library is ‘<em>Entities</em>’. An entity corresponds to a domain type of your application. Each entity object is responsible for:</p><ul><li>Defining the name of the entity type</li><li>Expressing how to convert a DynamoDB record to a well-typed object (“parsing”)</li><li>Creating partition key and sort key values</li></ul><p>Let’s demonstrate this with an example by creating an entity object for the AuthorBook type, expanding on a <a href="https://blog.devgenius.io/how-to-build-a-serverless-rest-api-with-nestjs-and-dynamodb-7b58b5b59bf6">previous post</a> creating an online library service.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62b873a8dc97c43ec723cf7eef2a2c2c/href">https://medium.com/media/62b873a8dc97c43ec723cf7eef2a2c2c/href</a></iframe><p>We will use the ‘Single Table Design’ approach, where we select the primary- and sort key so that we can fetch a collection of books from a specific author. For example, you could have the following records in DynamoDB for George Orwell&#39;s 1984 and Animal Farm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*O-eCvaA5J7gYAzgLQTn3Sg.png" /><figcaption>DynamoDB records</figcaption></figure><p>DynamoDB Entity Store uses default names for the primary (PK) and sort key (SK) adhering to the ‘Single Table Design’ approach. This can be configured in the setup. This will be covered more in-depth in the section below.</p><p>To enable operations on AuthorBook type you need to create an &#39;Entity&#39;. This entity describes how to construct the &#39;PK&#39; and &#39;SK&#39; attributes in the DynamoDB record. Also, a type predicate function must be added, so TypeScript unequivocally can determine the type of the object. The following code shows how you can create an entity for type AuthorBook:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/704183278be6d5f914cf2d2362d51f9b/href">https://medium.com/media/704183278be6d5f914cf2d2362d51f9b/href</a></iframe><p>The code shows how the <em>isAuthorBook</em> function helps determine whether the DynamoDB record is an AuthhorBook. This function is part of the arguments for the <em>createEntity</em> function.</p><p>The ‘<em>createEntity</em>’ function creates an entity object with the following arguments:</p><ul><li>type name</li><li><em>type predicate</em></li><li>function to generate PK value</li><li>function to generate SK value</li></ul><p>You only need to create this object once per type of entity in your application, and usually can be stateless so that you can define them as a global constant.</p><h4>⚙️Setup and Query operations</h4><p>Now that we have our entity object defined, we turn to configuring and executing querying operations.</p><p>To set up the client for DynamoDB operations, you create a &#39;<em>store&#39;</em> object. In the code fragment below, we use an ‘<em>AllEntitiesStore</em>’, which aligns with the ‘<em>Single Table Design</em>’ approach. An example of how the store object is created can be seen in the constructor of the BooksReposisory class in the code fragment.</p><p>The store uses the DynamoDB Document Client underneath. The store configures the client with an AWS account and region from environment variables and default marshalling/unmarshalling. You can override this behavior and provide your own Document Client object when creating a store context object with the function ‘createStoreContext’.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/856e2cc5acc566cc2dcea104800659c2/href">https://medium.com/media/856e2cc5acc566cc2dcea104800659c2/href</a></iframe><p>You can also configure a logger using the store context. This is a great help in developing as it shows how the actual DynamoDB query will be executed. In the above code fragment a ‘consoleLogger’ is created in the constructor. Other loggers are also possible. See an example of logging a DynamoDB query below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcda9cb45934f8039ecdaa372350910a/href">https://medium.com/media/dcda9cb45934f8039ecdaa372350910a/href</a></iframe><p>To create the store object you also need to give your table configuration as an argument in the ‘<em>createStore’</em> function. This can be easily done with the ‘<em>createStandardSingleTableConfig</em>’ function, creating a <em>TableConfig</em> object following ‘<em>Single Table design</em>’ conventions.</p><pre>let tableConfig: TableConfig = createStandardSingleTableConfig(this.tableName);</pre><p>When writing entities to DynamoDB, the DynamoDB Entity Store adds two extra attributes to the DynamoDB record:</p><ul><li>_et - the value of entity type</li><li>_lastUpdated - the current date-time</li></ul><p>In my case, I prefer to call the type attribute &#39;TYPE&#39;. Luckily, DynamoDB Entity Store lets you overwrite this config so you can adjust it to your preferences.</p><pre>tableConfig.metaAttributeNames.entityType = &#39;TYPE&#39;;</pre><blockquote>Adding a type attribute to your DynamoDB records in a table with multiple entities helps you to discriminate between them in several use cases. One such use case is for example <a href="https://serverlesscorner.com/how-to-filter-serverless-events-from-dynamodb-streams-c5f7c7250674">DynamoDB Streams</a>.</blockquote><h4>⚡Standard Single Entity Operations</h4><p>DynamoDB Entity Store offers a handle for entity operations making your life easier. It can be obtained from the <em>store</em> object in the following way:</p><pre>authorBookOps: SingleEntityOperations = this.store.for(AUTHOR_BOOK_ENTITY);</pre><p>This operations object has a number of methods, but to summarize they are:</p><ul><li>put()</li><li>get..() (two different flavors)</li><li>update()</li><li>delete()</li><li>query...() (multiple flavors)</li><li>scan...() (multiple flavors)</li></ul><p>See the <a href="https://github.com/symphoniacloud/dynamodb-entity-store/blob/main/documentation/GettingStartedWithOperations.md#standard-single-entity-operations">documentation</a> of DynamoDB Entity Store for more info.</p><p>DynamoDB Entity Store makes executing queries using the operations object very simple. Where you used to type out everything as a string for a query with AWS SDK, you can use functions with DynamoDB Entity Store. For example, to get all the books of a particular author you can do the following:</p><pre>books = await this.authorBookOps.queryOnePageByPkAndSk({firstName, lastName},<br>            rangeWhereSkBeginsWith(this.bookPrefix), {scanIndexForward: false});</pre><p>The operations objects knows how the AuthorBook entity is designed and uses that to construct the DynamoDB query. Together with helper functions such as ‘<em>rangeWhereSkBeginsWith’</em> it allows for very concise code.</p><p>Compared with AWS SDK code (below), DynamoDB Entity Store is far more readable and maintainable.</p><pre>//AWS SDK<br>const result = await this.db <br>.query({<br>            TableName: this.tableName,<br>            KeyConditionExpression: &#39;#PK=:PK AND begins_with(#SK, :SK)&#39;,<br>            ExpressionAttributeNames: {<br>                &#39;#PK&#39;: &#39;PK&#39;,<br>                &#39;#SK&#39;: &#39;SK&#39;<br>            },<br>            ExpressionAttributeValues: {<br>                &#39;:PK&#39;: this.authorPrefix.concat(lastName.toUpperCase()).concat(&quot;_&quot;).concat(firstName.toUpperCase()),<br>                &#39;:SK&#39;: this.bookPrefix<br>            },<br>            ScanIndexForward: false,<br>            Limit: 100<br>        })</pre><p>The shown functionality is just the tip of the iceberg. DynamoDB Entity Store offers far more. For example, it also offers handles for pagination and transactions. Learn more about it in the <a href="https://github.com/symphoniacloud/dynamodb-entity-store/blob/main/documentation/README.md">documentation</a> of the library.</p><h3>🙏 Conclusion</h3><p>Working with AWS SDK for DynamoDB is not that optimal. It is a low-level API that will create hard-to-maintain code. The new AWS SDK v3 version makes it even harder. Fortunately, there are alternatives for the AWS SDK as DynamoDB Entity Store. DynamoDB Entity Store abstracts all this plumbing away and allows you to write concise code that is readable and maintainable.</p><p>DynamoDB Entity Store embraces the ‘Single Table Design’ approach and lets you easily create entities and execute queries. It has sensible defaults that offer protection against costly operations with DynamoDB. The library is flexible enough to let you adjust it to your needs.</p><p>Give it a try and let me know if it gives you the same advantages as I have experienced.</p><p>So, this wraps it up. I hope this helps you in your Serverless journeys. The code for this project can be found on Github👇 <a href="https://github.com/cyberworkz/examples">https://github.com/cyberworkz/examples</a> in the ddb-entity-storefolder.</p><h3>Haiko van der Schaaf</h3><ul><li><strong><em>If you enjoyed this, please </em></strong><a href="https://serverlesscorner.com/about"><strong><em>follow Serverlesscorner.com on Medium</em></strong></a><strong><em>.</em></strong></li><li><strong><em>Follow me on </em></strong><a href="https://bsky.app/profile/serverlesscorner.com"><strong><em>Bluesky</em></strong></a><strong><em> 🟦 for my latest content about serverless technology!</em></strong></li></ul><h3>Related stories</h3><ul><li><a href="https://blog.devgenius.io/how-to-build-a-serverless-rest-api-with-nestjs-and-dynamodb-7b58b5b59bf6">How to Build a Serverless REST API with NestJS and DynamoDB</a></li><li><a href="https://blog.devgenius.io/how-to-do-single-table-design-with-dynamodb-db9101a43277">How to do Single-table design with DynamoDB?</a></li><li><a href="https://serverlesscorner.com/how-to-filter-serverless-events-from-dynamodb-streams-c5f7c7250674">How to filter Serverless events from DynamoDB streams</a></li><li><a href="https://blog.devgenius.io/how-to-use-dynamodb-streams-to-feed-algolia-search-2f1de8eba64d">How to use DynamoDB streams to feed Algolia search</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b6db5c0c6ba" width="1" height="1" alt="">]]></content:encoded>
    </item>
    <item>
      <title><![CDATA[Add some layers to your AWS Lambda]]></title>
      <link>https://levelup.gitconnected.com/add-some-layers-to-your-aws-lambda-5f6c3ab1f39b?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/5f6c3ab1f39b</guid>
      <category><![CDATA[lambda-layer]]></category>
      <category><![CDATA[separation-of-concerns]]></category>
      <category><![CDATA[aws-lambda]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Sun, 03 Sep 2023 15:52:58 GMT</pubDate>
      <atom:updated>2023-09-03T15:52:58.769Z</atom:updated>
      <content:encoded><![CDATA[<p>What are Lambda layers?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FJ-ah4AF9lLqod-e" /><figcaption>Photo by <a href="https://unsplash.com/@profwicks?utm_source=medium&amp;utm_medium=referral">Ben Wicks</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>We all know that adding some extra things can give excellent results. A layer of cheese to your burger, some wasabi to your sushi, and an extra layer code to your Lambda function. Yes, that’s right, you can add Lambda layers to your Lambda function. Lambda layers allow you to manage your Lambda functions more efficiently.</p><h4>Lambda layer</h4><p>Lambda layers is a .zip file archive that contains supplementary code or data. Layers usually contain library dependencies, a <a href="https://docs.aws.amazon.com/lambda/latest/dg/runtimes-custom.html">custom runtime</a>, or configuration files. You can include up to five layers per function. Also, you can use layers only with Lambda functions deployed as a .zip file archive. An example of such a Lambda layer is <a href="https://docs.powertools.aws.dev/lambda/typescript/1.12.1/">Powertools for AWS Lambda</a>. See the following <a href="https://medium.com/gitconnected/serverless-metrics-with-aws-emf-c7d3ea57dc6e">article</a> on how to incorporate a Lambda layer with the Serverless Framework.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3e2f64f63aea4e8447c5f52a5c388da/href">https://medium.com/media/f3e2f64f63aea4e8447c5f52a5c388da/href</a></iframe><h4>Why should you use Lambda layers?</h4><p>Lambda layers give you some extra flexibility and ways to manage your code. It gives you the following options:</p><ul><li><strong>Reduce package size</strong> — Move some code, organized in a cohesive way, to a layer reducing the size of your package which gives faster deployments and development speed. This allows you to extend a Lambda function from 50MB to a maximum of 250MB. But, <a href="https://serverlesscorner.com/5-ways-to-deal-with-cold-starts-dcbb8967edf9">smaller is better with AWS Lambda</a>.</li><li><strong>Separate concerns</strong> — In a large ecosystem with a lot of services and multiple teams, platform or cross-cutting functionality can be offered in a layer to higher services to enforce a common architecture and give a clear separation between teams. Teams responsible for the code in the layer can update the layer in the function separately from teams producing the higher services.</li><li><strong>Share code </strong>— Often you have a domain model or utility code that is shared by multiple services. Lambda layers offers an efficient way to share it across multiple Lambda functions and maintain it in an easy manner.</li></ul><h4>Drawbacks</h4><p>As with any tool, there are some areas you should pay attention to when using Lambda layers.</p><ul><li><strong>Local dev environment</strong> — Setting up local dev environment takes some extra effort. The layer must also be offered as a package that can be used locally.</li><li><strong>Security</strong> — Beware of using external layers. Make sure that when using external layers it is from a trustworthy source. You can use <a href="https://aws.amazon.com/blogs/aws/amazon-inspector-now-scans-aws-lambda-functions-for-vulnerabilities/">AWS Inspector</a> to scan for any irregularities.</li></ul><h4>Conclusion</h4><p>Lambda layers is an option to reduce the size of your Lambda function and organize code. Specifically in a big enterprise environment with multiple teams, Lambda layers can help in separating concerns and organizing code.</p><p>There are some drawbacks that you should address, but they are easily mitigated.</p><p>In the upcoming article, we will look at how we can create a layer inside your AWS account.</p><p>Have fun coding!</p><h3>Haiko van der Schaaf</h3><p><strong><em>If you enjoyed this, please </em></strong><a href="https://serverlesscorner.com/about"><strong><em>follow Serverlesscorner.com on Medium</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f6c3ab1f39b" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/add-some-layers-to-your-aws-lambda-5f6c3ab1f39b">Add some layers to your AWS Lambda</a> was originally published in <a href="https://levelup.gitconnected.com">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
    </item>
    <item>
      <title><![CDATA[Dodging the Lambda Pinball with DDD]]></title>
      <link>https://medium.com/@hvdschaaf/dodging-the-lambda-pinball-with-ddd-9a5ed216c7e8?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/9a5ed216c7e8</guid>
      <category><![CDATA[serverless]]></category>
      <category><![CDATA[domain-driven-design]]></category>
      <category><![CDATA[aws-lambda]]></category>
      <category><![CDATA[cloud-computing]]></category>
      <category><![CDATA[serverless-architecture]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Tue, 16 May 2023 04:17:20 GMT</pubDate>
      <atom:updated>2024-11-05T09:47:44.754Z</atom:updated>
      <content:encoded><![CDATA[<h4>An approach on how to design your Lambda’s</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TVDYrFyxOiVF6xzp" /><figcaption>Photo by <a href="https://unsplash.com/@hjmckean?utm_source=medium&amp;utm_medium=referral">Heather McKean</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The latest <a href="https://www.thoughtworks.com/radar">Thoughtworks radar</a> of April 2023 warns of using serverless technology for it increases the complexity and risks ending up with a <a href="https://www.thoughtworks.com/radar/techniques/lambda-pinball">Lambda pinball architecture</a>.</p><h3>Boris Tane on Twitter: &quot;what&#39;s the worst lambda pinball architecture you&#39;ve seen in the wild? pic.twitter.com/CEsq0x3HF8 / Twitter&quot;</h3><p>what&#39;s the worst lambda pinball architecture you&#39;ve seen in the wild? pic.twitter.com/CEsq0x3HF8</p><p>The problem originates from the fact that when execution and data flows across multiple interdependent Lambdas, at a code level, simple mapping between domain concepts and the multiple Lambdas involved is practically impossible, making any changes and additions challenging. In short, when you don’t properly design your lambda’s you end up with a <em>distributed</em> <a href="https://www.techopedia.com/definition/9476/spaghetti-code">spaghetti-code</a> jungle, the previously used GOTOs are here replaced with events between the interdependent Lambdas.</p><blockquote>Spaghetti Code’ is a phrase, an <a href="https://en.wikipedia.org/wiki/Anti-pattern">antipattern</a> for unstructured, difficult-to-maintain code that is every developer’s nightmare. The word ‘spaghetti’ here refers to the flow of the program being tangled like ‘spaghetti’. It is also called ‘code that is difficult to follow by a human’.</blockquote><p>As the reference indicates, this is not a new problem. The term already appears in the 1970s. However, the impact is more significant now as we are exposing public interfaces to other services. Luckily, this problem is already solved for us. We only have to know how to apply this to Lambda architecture.</p><h4><strong>What should we put in a Lambda function?</strong></h4><p>There are two questions here. How much code fits in a Lambda and <em>which</em> code should go into the Lambda?</p><p>Let’s start with how much code fits in a Lambda. Traditionally, you would build an application that contains all the functionality. The application would contain multiple services (aka modules, packages, etc). Each service would contain one or multiple functions (aka methods). You would run the application on hardware, on a VM, or in a Docker container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*d5VFJC3Kf00WX5UPo2ekEQ.png" /><figcaption>application, service, and function relation</figcaption></figure><p>A lambda has its limitations regarding deployment size. AWS Lambda size limit is 50 MB when you upload the code directly. With Lambda layers you can have a maximum of 250MB for your package.</p><p>With these limitations in mind, we should scope what should fit into a Lambda to either a service or a function.</p><h4>Which code should go into a Lambda?</h4><p>Now we are arriving at the most important question to avoid the Lambda Pinball, how to decide which code should go into a Lambda?</p><p>The goal here is to organize code in such a way that changing the code somewhere will make the least ripple effect on other parts of your system. To do this you should guide your efforts in organizing your code by the ‘<em>Single Responsibility Principle</em>’.</p><blockquote>The <a href="https://en.wikipedia.org/wiki/Single-responsibility_principle"><strong>single-responsibility principle</strong> </a>(<strong>SRP</strong>) is a computer programming principle that states that “A module should be responsible to one, and only one, actor.” It was coined by Robert C. Martin aka Uncle Bob.</blockquote><blockquote>Martin defines a responsibility as a <em>reason to change</em>, and concludes that a class or module should have one, and only one, reason to be changed (e.g. rewritten).</blockquote><h4>Domain Driven Design</h4><p>A lambda function therefore should have a single responsibility. But at what granular level should we apply this? An effective way to organize responsibilities is to look at the concepts of a business domain as used in ‘<a href="https://martinfowler.com/bliki/DomainDrivenDesign.html">Domain Driven Design</a>’ (DDD)</p><blockquote><strong>Domain-driven design</strong> (<strong>DDD</strong>) is a major <a href="https://en.wikipedia.org/wiki/Software_design">software design</a> approach, focusing on modeling software to match a <a href="https://en.wikipedia.org/wiki/Domain_(software_engineering)">domain</a> according to input from that domain’s experts.</blockquote><p>DDD aims to group concepts and functionality into a single (business) domain. An e-commerce application could have for example an <em>Inventory domain</em>, <em>Invoice domain</em>, and<em> Shipping domain.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQltcwXSqLFW5BatUf_yPQ.png" /><figcaption>e-commerce domains</figcaption></figure><p>These domains are too big for a single function. Therefore for using Lambda, we should match the concept of a <em>Service</em> with a <em>Domain</em>. The Service should contain all functions related to the particular domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*13D6mBRZMEaF8Yu_0YlVMg.png" /><figcaption>Domains, services, and Lambda’s</figcaption></figure><p>Organizing code in this way will decrease dependence between Lambda’s and makes it easy to map domain concepts. Changing code for a single business domain will be easier and maintainability is increased. This will avoid tight coupling and cut down on unnecessary inter-lambda communication using events.</p><h4>Conclusion</h4><p>A naive approach to putting code into Lambda will result in a distributed spaghetti code jungle making any changes and additions challenging.</p><p>Using the ‘<em>Single Responsibility Principle</em>’ with Domain Driven Design concepts your code you can organize your code across Lambda functions in a maintainable way. Following this recipe to design your system allows you to experience pinball at the right venue, the arcade hall 🕹️👾.</p><p>Have fun coding!</p><h3>Haiko van der Schaaf</h3><ul><li><strong><em>If you enjoyed this, please </em></strong><a href="https://serverlesscorner.com/about"><strong><em>follow Serverlesscorner.com on Medium</em></strong></a><strong><em>.</em></strong></li><li><strong><em>Follow me on </em></strong><a href="https://bsky.app/profile/serverlesscorner.com"><strong><em>Bluesky</em></strong></a><strong><em> 🟦 for my latest content about serverless technology!</em></strong></li></ul><h3>Related stories</h3><ul><li><a href="https://serverlesscorner.com/improving-cold-starts-using-lambda-snapstart-9d26577cca60">Does AWS Lambda SnapStart make sense?</a></li><li><a href="https://serverlesscorner.com/serverless-vs-cdk-a7f3ee391f24">Serverless vs CDK</a></li><li><a href="https://serverlesscorner.com/s3-trigger-serverless-csv-upload-into-dynamodb-8877c770fb32">S3 trigger: Serverless CSV upload into DynamoDB</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a5ed216c7e8" width="1" height="1" alt="">]]></content:encoded>
    </item>
    <item>
      <title><![CDATA[Serverless metrics with AWS EMF]]></title>
      <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://levelup.gitconnected.com/serverless-metrics-with-aws-emf-c7d3ea57dc6e?source=rss-a9f2f75ff5f6------2"><img src="https://cdn-images-1.medium.com/max/2600/0*4VsRgge6mjvBP_Gf" width="3999"></a></p><p class="medium-feed-snippet">Lambda metrics with AWS Lambda Powertools</p><p class="medium-feed-link"><a href="https://levelup.gitconnected.com/serverless-metrics-with-aws-emf-c7d3ea57dc6e?source=rss-a9f2f75ff5f6------2">Continue reading on Level Up Coding »</a></p></div>]]></description>
      <link>https://levelup.gitconnected.com/serverless-metrics-with-aws-emf-c7d3ea57dc6e?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/c7d3ea57dc6e</guid>
      <category><![CDATA[cloudwatch-custom-metrics]]></category>
      <category><![CDATA[serverless-architecture]]></category>
      <category><![CDATA[aws-lambda]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Wed, 22 Mar 2023 02:14:26 GMT</pubDate>
      <atom:updated>2023-03-22T02:14:26.893Z</atom:updated>
    </item>
    <item>
      <title><![CDATA[ServerlessCorner Monthly: February 2023]]></title>
      <link>https://medium.com/serverlesscorner-newsletter/serverlesscorner-monthly-february-2023-7623a78de952?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/7623a78de952</guid>
      <category><![CDATA[airbnb]]></category>
      <category><![CDATA[aws-step-functions]]></category>
      <category><![CDATA[serverless]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Mon, 20 Feb 2023 08:57:48 GMT</pubDate>
      <atom:updated>2023-02-20T08:57:48.115Z</atom:updated>
      <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MOtqZVbxD18BwnxD" /><figcaption>Photo by <a href="https://unsplash.com/@hishahadat?utm_source=medium&amp;utm_medium=referral">Shahadat Rahman</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>⭐ Welcome to the February ServerlessCorner newsletter.⭐</p><p>⚙️Event-driven programming got a lot of love during the recent AWS re:Invent, but too many loosely coupled events can feel like a <a href="https://betterprogramming.pub/is-your-microservices-architecture-more-pinball-or-mcdonalds-9d2a79224da7">pinball architecture</a>. <strong>AWS Step functions is a serverless service </strong>to orchestrate workflows. The first story ‘What is AWS Step functions’ will give you insight how it can help to orchestrate your lambda microservices.</p><p><strong>🔒</strong>The second story is from <strong>Airbnb security </strong>and shows how they leveraged serverless technology as AWS Lambda and AWS Step functions to automate end-to-end certificate rotations.</p><p>📈 Third, an article about <strong>metrics for asynchronous Lambdas</strong>. Where it was difficult to monitor the processing of asynchronous invocations, now there are new metrics that provide visibility for asynchronous Lambda function invocations.</p><p><strong>🔍 </strong>And lastly, an introduction of <strong>AWS Inspector. </strong>AWS Inspector scans for vulnerabilities in your AWS Lambda functions and Lambda layers.</p><p>Have fun reading 🚀</p><p>If you like to receive more exciting stories about serverless technology and its use cases please <a href="https://serverlessconsulting.org/newsletter/">sign up on Serverlesscorner newletters</a>.</p><p><a href="https://serverlessconsulting.org/newsletter/">Subscribe</a></p><p><strong>This month’s stories:</strong></p><p><strong>⚡️What is AWS Step Functions? How It Works &amp; Use Cases</strong></p><p><strong>⚡️ Meet Ottr: A Serverless Public Key Infrastructure Framework</strong></p><p><strong>⚡️ Introducing new asynchronous invocation metrics for AWS Lambda</strong></p><p><strong>⚡️AWS Inspector for your Lambda’s</strong></p><ul><li><a href="https://www.resmo.com/blog/what-is-aws-step-functions">What is AWS Step Functions? How It Works &amp; Use Cases | Resmo</a></li><li><a href="https://medium.com/airbnb-engineering/meet-ottr-a-serverless-public-key-infrastructure-framework-f6580010ae0c">Meet Ottr: A Serverless Public Key Infrastructure Framework</a></li><li><a href="https://aws.amazon.com/blogs/compute/introducing-new-asynchronous-invocation-metrics-for-aws-lambda/">Introducing new asynchronous invocation metrics for AWS Lambda | Amazon Web Services</a></li><li><a href="https://aws.amazon.com/blogs/aws/amazon-inspector-now-scans-aws-lambda-functions-for-vulnerabilities/">Amazon Inspector Now Scans AWS Lambda Functions for Vulnerabilities | Amazon Web Services</a></li></ul><p>If you like to receive more exciting stories about serverless technology and its use cases please <a href="https://serverlessconsulting.org/newsletter/">sign up on Serverlesscorner newletters</a>.</p><p><a href="https://serverlessconsulting.org/newsletter/">Subscribe</a></p><p><em>PS.</em> <em>Love </em>❤️ <em>reading</em> <em>my stories and other ones on Medium? </em><a href="https://serverlesscorner.com/membership?utm_campaign=Serverlesscorner%20newsletter%20about%20Serverless%20technology&amp;utm_medium=email&amp;utm_source=Revue%20newsletter"><em>Become a member</em></a><em> if you ain’t already.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7623a78de952" width="1" height="1" alt=""><hr><p><a href="https://medium.com/serverlesscorner-newsletter/serverlesscorner-monthly-february-2023-7623a78de952">ServerlessCorner Monthly: February 2023</a> was originally published in <a href="https://medium.com/serverlesscorner-newsletter">serverlesscorner newsletter</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
    </item>
    <item>
      <title><![CDATA[Check business targets with AWS EMF]]></title>
      <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://levelup.gitconnected.com/check-business-targets-with-aws-emf-2e2017aa31b9?source=rss-a9f2f75ff5f6------2"><img src="https://cdn-images-1.medium.com/max/2600/0*abeSnCcWl5nC_76X" width="4810"></a></p><p class="medium-feed-snippet">Track your targets with AWS Lambda and Cloudwatch EMF</p><p class="medium-feed-link"><a href="https://levelup.gitconnected.com/check-business-targets-with-aws-emf-2e2017aa31b9?source=rss-a9f2f75ff5f6------2">Continue reading on Level Up Coding »</a></p></div>]]></description>
      <link>https://levelup.gitconnected.com/check-business-targets-with-aws-emf-2e2017aa31b9?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/2e2017aa31b9</guid>
      <category><![CDATA[cloudwatch]]></category>
      <category><![CDATA[business-metrics]]></category>
      <category><![CDATA[aws-emf]]></category>
      <category><![CDATA[aws-lambda]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Mon, 20 Feb 2023 03:32:18 GMT</pubDate>
      <atom:updated>2023-03-22T08:18:21.384Z</atom:updated>
    </item>
    <item>
      <title><![CDATA[ServerlessCorner issue — #11]]></title>
      <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/serverlesscorner-newsletter/serverlesscorner-issue-11-a2294ed6adb2?source=rss-a9f2f75ff5f6------2"><img src="https://cdn-images-1.medium.com/max/2600/0*YURpyBVRvulyV1hR" width="4195"></a></p><p class="medium-feed-snippet">&#x2B50; Welcome to the revamped ServerlessCorner newsletter.&#x2B50;</p><p class="medium-feed-link"><a href="https://medium.com/serverlesscorner-newsletter/serverlesscorner-issue-11-a2294ed6adb2?source=rss-a9f2f75ff5f6------2">Continue reading on serverlesscorner newsletter »</a></p></div>]]></description>
      <link>https://medium.com/serverlesscorner-newsletter/serverlesscorner-issue-11-a2294ed6adb2?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/a2294ed6adb2</guid>
      <category><![CDATA[serverless]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Sat, 14 Jan 2023 16:12:59 GMT</pubDate>
      <atom:updated>2023-01-14T16:19:04.466Z</atom:updated>
    </item>
    <item>
      <title><![CDATA[Serverlesscorner Monthly — Issue #10]]></title>
      <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/serverlesscorner-newsletter/serverlesscorner-monthly-issue-10-294b9b8e2c67?source=rss-a9f2f75ff5f6------2"><img src="https://cdn-images-1.medium.com/max/600/0*XHpiphrjlYkPNnoa" width="600"></a></p><p class="medium-feed-snippet">Welcome to the last Serverlesscorner newsletter of 2022.</p><p class="medium-feed-link"><a href="https://medium.com/serverlesscorner-newsletter/serverlesscorner-monthly-issue-10-294b9b8e2c67?source=rss-a9f2f75ff5f6------2">Continue reading on serverlesscorner newsletter »</a></p></div>]]></description>
      <link>https://medium.com/serverlesscorner-newsletter/serverlesscorner-monthly-issue-10-294b9b8e2c67?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/294b9b8e2c67</guid>
      <category><![CDATA[serverless]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Thu, 15 Dec 2022 09:39:24 GMT</pubDate>
      <atom:updated>2022-12-15T09:39:24.088Z</atom:updated>
    </item>
    <item>
      <title><![CDATA[Does AWS Lambda SnapStart make sense?]]></title>
      <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@hvdschaaf/improving-cold-starts-using-lambda-snapstart-9d26577cca60?source=rss-a9f2f75ff5f6------2"><img src="https://cdn-images-1.medium.com/max/1038/1*yvwPF-mUH8CHwuCbDI5vPg.png" width="1038"></a></p><p class="medium-feed-snippet">How to use Lambda Snapstart for your Java function</p><p class="medium-feed-link"><a href="https://medium.com/@hvdschaaf/improving-cold-starts-using-lambda-snapstart-9d26577cca60?source=rss-a9f2f75ff5f6------2">Continue reading on Medium »</a></p></div>]]></description>
      <link>https://medium.com/@hvdschaaf/improving-cold-starts-using-lambda-snapstart-9d26577cca60?source=rss-a9f2f75ff5f6------2</link>
      <guid isPermaLink="false">https://medium.com/p/9d26577cca60</guid>
      <category><![CDATA[java]]></category>
      <category><![CDATA[software-development]]></category>
      <category><![CDATA[programming]]></category>
      <category><![CDATA[aws]]></category>
      <category><![CDATA[lambda]]></category>
      <dc:creator><![CDATA[Haiko van der Schaaf]]></dc:creator>
      <pubDate>Mon, 12 Dec 2022 17:00:34 GMT</pubDate>
      <atom:updated>2025-07-15T13:44:11.731Z</atom:updated>
    </item>
  </channel>
</rss>
