<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Marko - ServerlessLife.com</title>
    <description>The latest articles on Forem by Marko - ServerlessLife.com (@serverlessl).</description>
    <link>https://forem.com/serverlessl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F510944%2F328de472-114f-4399-9e77-5718a19a0e43.png</url>
      <title>Forem: Marko - ServerlessLife.com</title>
      <link>https://forem.com/serverlessl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/serverlessl"/>
    <language>en</language>
    <item>
      <title>CDK Booster - Speeding Up Bundling of Lambda Handlers</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Mon, 29 Sep 2025 15:57:21 +0000</pubDate>
      <link>https://forem.com/serverlessl/cdk-booster-speeding-up-bundling-of-lambda-handlers-4lgk</link>
      <guid>https://forem.com/serverlessl/cdk-booster-speeding-up-bundling-of-lambda-handlers-4lgk</guid>
      <description>&lt;p&gt;&lt;strong&gt;Stop waiting for CDK to bundle Lambda functions. CDK Booster accelerates TypeScript/JavaScript builds with seamless integration.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;One of AWS Cloud Development Kit (AWS CDK)'s main drawbacks is that it executes tasks sequentially, including the bundling of Lambda code. For large projects with many functions, this can make the process painfully slow.&lt;/p&gt;

&lt;p&gt;That’s why I created &lt;a href="https://www.cdkbooster.com" rel="noopener noreferrer"&gt;CDK Booster&lt;/a&gt;. It bundles all Lambda functions created with the &lt;code&gt;NodejsFunction&lt;/code&gt; construct in one go, producing the same per-function assets CDK would normally generate. It’s a drop-in replacement: no code changes required, just installation and a small tweak to &lt;code&gt;cdk.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;CDK Booster aslo prevents double bundling. Sometimes CDK triggers synthesis twice because certain resources require lookups before they can be resolved. Normally, this would mean all Lambda functions are bundled twice as well. CDK Booster detects this and prevents unnecessary duplicate bundling.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Benefits
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Much faster builds&lt;/strong&gt; on projects with many TypeScript/JavaScript Lambda functions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Seamless integration&lt;/strong&gt; – drop-in replacement, no code changes needed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smarter bundling&lt;/strong&gt; – avoids running twice during repeated synth&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;cdk-booster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Modify your &lt;code&gt;cdk.json&lt;/code&gt; file:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Replace this:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"app"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx ts-node --prefer-ts-exts bin/your_app.ts"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;With this:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"app"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"npx cdk-booster bin/your_app.ts"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;...&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;bin/your_app.ts&lt;/code&gt; is location to your CDK app.&lt;/p&gt;

&lt;p&gt;All functions created with the &lt;code&gt;NodejsFunction&lt;/code&gt; construct are automatically bundled using CDK Booster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;lambda_nodejs&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;aws-cdk-lib/aws-lambda-nodejs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;functionTestJsEsModule&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;lambda_nodejs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;NodejsFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;TestJsEsModule&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;lambda.ts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;CDK Booster operates through a multi-phase process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Transpilation&lt;/strong&gt; – ESbuild compiles CDK code and injects discovery logic for Lambda functions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Descovery phase&lt;/strong&gt; – CDK code runs in Node.js worker threads, identifying functions and build commands.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bundling&lt;/strong&gt; – all handlers are bundled at once using ESbuild’s multiple entry points. This approach is what provides the significant speed improvement. Bundled assets are placed in the &lt;code&gt;cdk.out/bundling-temp-*&lt;/code&gt; folders for CDK to consume.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CDK synth&lt;/strong&gt; – the regular CDK process runs, skipping redundant bundling since assets are ready.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Asset reuse&lt;/strong&gt; – if synth reruns (e.g., for lookups), CDK Booster reuses existing bundles.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;CDK Booster shines in large projects with dozens of Lambda functions, where sequential bundling can significantly slow down the build process. For smaller applications, the speedup is less dramatic but still helpful.&lt;/p&gt;

&lt;p&gt;Note that bundling itself is rarely the slowest step in deployment—most of the time is consumed by CloudFormation. CDK Booster targets the bundling phase specifically, making it faster and avoiding duplicate work when synthesis runs more than once.&lt;/p&gt;

&lt;p&gt;The result is a leaner, more efficient development workflow: less waiting, quicker feedback, and more time to focus on building features instead of watching your code bundle.&lt;/p&gt;

</description>
      <category>cdk</category>
      <category>aws</category>
    </item>
    <item>
      <title>Lambda Live Debugger vs Official AWS Remote Debugging</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Tue, 22 Jul 2025 16:37:11 +0000</pubDate>
      <link>https://forem.com/serverlessl/lambda-live-debugger-vs-official-aws-remote-debugging-1ae6</link>
      <guid>https://forem.com/serverlessl/lambda-live-debugger-vs-official-aws-remote-debugging-1ae6</guid>
      <description>&lt;p&gt;&lt;strong&gt;AWS now supports Lambda remote debugging. How does it compare to Lambda Live Debugger, and why is that great news for the project.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AWS finally supports Lambda remote debugging — something developers have been waiting for for years. This is similar to my &lt;a href="https://www.lldebugger.com/" rel="noopener noreferrer"&gt;Lambda Live Debugger&lt;/a&gt;. This is great news for developers and also for the Lambda Live Debugger project. It will help make this approach more popular, as more developers will see that this is by far the most productive way of developing serverless applications. And &lt;strong&gt;since Lambda Live Debugger has several key advantages, this also means great news for the project.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is a comparison between the two solutions:&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;

&lt;p&gt;Both solutions work by attaching a Layer to the Lambda function. The official AWS solution removes the Layer immediately after the Lambda is invoked. Lambda Live Debugger leaves the Layer attached until you decide to remove it. Both solutions use AWS IoT to communicate with your computer.&lt;/p&gt;

&lt;p&gt;The official AWS solution runs a debugger on the Lambda itself and then connects to your VS Code. That means with the official AWS debugger, when you change code, you must upload it to the cloud to debug.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzajpfbh38h9n94ky93sl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzajpfbh38h9n94ky93sl.png" alt="Official AWS Debugger Architecture" width="541" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In contrast, &lt;strong&gt;Lambda Live Debugger&lt;/strong&gt; sends the event alongside IAM permissions to your computer, and the debugger runs locally. Since the code runs on your machine, you don’t need to upload anything. &lt;strong&gt;Reloading and, if needed, transpiling/compiling TypeScript to JavaScript happens automatically and instantly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pcxtl1q3wdfvxmruc33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2pcxtl1q3wdfvxmruc33.png" alt="Lambda Live Debugger Architecture" width="551" height="340"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, there’s one important benefit to how the official AWS debugger works: since the debugger is running in Lambda, it has access to resources inside a VPC, which Lambda Live Debugger cannot access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Supported Languages
&lt;/h2&gt;

&lt;p&gt;Official AWS Lambda remote debugging supports JavaScript, Python, and Java. JavaScript source maps are not supported, which makes debugging TypeScript impossible. If I understood correctly, support is on the way. Because source maps are not supported, it would be extremely difficult/impossible to debug code that was bundled and minified.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger only supports JavaScript and TypeScript. TypeScript support with automatic transpiling/compiling is a key feature.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Lambda Handler Source Code
&lt;/h2&gt;

&lt;p&gt;Official AWS Lambda debugging requires you to point to your local code or download it from the cloud. The debugger just steps through that code; actual execution still happens in the cloud. You can’t point to your TypeScript code — only to the transpiled version. That’s very hard to do if you’re using AWS CDK, because the assets are in random folders under &lt;code&gt;cdk.out&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger does not require this. It can read your framework configuration and automatically find the source code.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Supported Frameworks
&lt;/h2&gt;

&lt;p&gt;The official AWS Lambda debugging does not support any framework. Linking a Lambda to the source code requires manual clicking. That’s why the solution is deeply integrated into VS Code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger supports all popular frameworks&lt;/strong&gt; (CDK, Serverless Framework, SAM, Terraform, OpenTofu). This was most challenging for me when building the tool. It was especially difficult to support CDK. The tool automatically finds the Lambda's source code. You just need to enter a few key parameters when configuring the project.&lt;/p&gt;

&lt;p&gt;Lambda Live Debugger also works if you have your own unique setup — just list your Lambdas.&lt;/p&gt;

&lt;h2&gt;
  
  
  Supported IDE
&lt;/h2&gt;

&lt;p&gt;The official AWS debugger is integrated with VS Code via the AWS Toolkit extension. No other IDEs are supported.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger&lt;/strong&gt; doesn’t depend on a specific IDE — because the debugger runs on your local machine, any tool that supports JavaScript debugging works. But the tool generates debugging configuration for &lt;strong&gt;VS Code and JetBrains IDEs like WebStorm&lt;/strong&gt;, so the debugging is seamless, with just starting the debugger.&lt;/p&gt;

&lt;h2&gt;
  
  
  Capturing Events
&lt;/h2&gt;

&lt;p&gt;Official AWS Lambda remote debugging intercepts only events invoked from VS Code. That makes it impossible to intercept live events that occur in the system. You need to prepare your own sample payload. You can debug only one Lambda at a time. &lt;strong&gt;This makes it impossible to debug a system as a whole&lt;/strong&gt;. I do not know why they decided to do that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger can debug multiple Lambdas and can capture real events that happen in the system.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Developer experience
&lt;/h2&gt;

&lt;p&gt;I must say the developer experience with the official AWS solution &lt;strong&gt;feels clumsy&lt;/strong&gt;. First, you need to find your Lambda in the list of all Lambdas you have in your account in your region. Then you need to link it to the source code. You need to write a sample payload, and then you can invoke the function. You need to do that for every function. If you change your code, you need to upload the new version. The VS Code extension asks you to do that for you. But the process is slow, and you always have to disconnect and reconnect the debugger to get the new version.&lt;/p&gt;

&lt;p&gt;With Lambda Live Debugger, you just run the wizard once, where you mostly confirm the default settings. Then you start the debugger. &lt;strong&gt;No need to enter a sample payload, no need to reupload the code.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary of Benefits
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Official AWS Remote Debugging:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Can access private VPC resources.&lt;/li&gt;
&lt;li&gt;Supports Python and Java in addition to JavaScript.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Support TypeScript with automatic transpiling/compiling.&lt;/li&gt;
&lt;li&gt;No uploads are needed when code changes.&lt;/li&gt;
&lt;li&gt;Debug multiple Lambdas at once.&lt;/li&gt;
&lt;li&gt;Captures real events happening in your system, not just sample events you write yourself.&lt;/li&gt;
&lt;li&gt;Supports all popular frameworks (CDK, Serverless Framework, SAM, Terraform, OpenTofu)&lt;/li&gt;
&lt;li&gt;Automatic configuration for VS Code and JetBrains IDEs. Works with any IDE that supports JavaScript debugging.&lt;/li&gt;
&lt;li&gt;Automatically finds Lambda source code.&lt;/li&gt;
&lt;li&gt;Fast, seamless developer experience integrated with your framework of choice.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;It’s exciting to see AWS embrace remote debugging — it validates how powerful this approach is for serverless development. However, while the official solution lays important groundwork, it currently comes with significant limitations, especially for TypeScript developers and real-world debugging scenarios.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Lambda Live Debugger remains the most flexible, developer-friendly, and efficient option for debugging JavaScript and TypeScript Lambdas. It’s ideal for working with modern frameworks, real traffic, and complex serverless systems.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The official AWS Remote Debugging is the go-to choice if you're working with Python or Java, or if you need to access resources inside a private VPC.&lt;/p&gt;

&lt;p&gt;As the ecosystem evolves, having both tools available is a win for developers. Choose the one that fits your workflow — or use both where they shine.&lt;/p&gt;

</description>
      <category>lambda</category>
      <category>serverless</category>
      <category>aws</category>
    </item>
    <item>
      <title>I Passed 5 AWS Certifications in 5 Days: 15 Essential Tips</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Thu, 09 Jan 2025 07:25:18 +0000</pubDate>
      <link>https://forem.com/serverlessl/i-passed-5-aws-certifications-in-5-days-15-essential-tips-32po</link>
      <guid>https://forem.com/serverlessl/i-passed-5-aws-certifications-in-5-days-15-essential-tips-32po</guid>
      <description>&lt;p&gt;&lt;strong&gt;When coffee is your best friend and determination is your fuel, passing 5 AWS certs in 5 days becomes more than a crazy goal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In January 2025, all five of my AWS certifications were set to expire: three associate-level and two professional-level certifications. For those familiar with AWS certifications, you know how challenging they can be—even for seasoned AWS professionals. While associate-level exams are tough, professional-level exams are downright brutal, far surpassing the difficulty of any university exams I’ve taken.&lt;/p&gt;

&lt;p&gt;I decided to tackle all five exams over five days (January 2–6). Crazy? Probably. But I passed them all:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Certified Solutions Architect Associate&lt;/li&gt;
&lt;li&gt;AWS Certified Developer Associate&lt;/li&gt;
&lt;li&gt;AWS Certified DevOps Professional&lt;/li&gt;
&lt;li&gt;AWS Certified SysOps Administrator Associate&lt;/li&gt;
&lt;li&gt;AWS Certified Solutions Architect Professional&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was my third time taking the associate exams and second time taking the professional ones. Here are 15 essential tips I’ve picked up along the way.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Pick the Best Courses
&lt;/h2&gt;

&lt;p&gt;This one’s easy. &lt;a href="https://www.udemy.com/user/stephane-maarek/" rel="noopener noreferrer"&gt;Stephane Maarek&lt;/a&gt;’s Udemy courses are by far the best. It is unbelievable how quickly you can learn with his courses. I cannot compare it to any course I have ever gone through or any teacher I have had at school or university. It is crazy that you can get them for $10 on sale. And he constantly upgrades them. Also, buy his practice exams, you will need them. If you plan to take professional exams, buy associate courses as well. They are foundational for professional-level content.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Get a 50% discount
&lt;/h2&gt;

&lt;p&gt;Once you pass the exam, you get a 50% discount on your next exam. It expires after 3 years. Exams are pretty expensive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.serverlesslife.com/I_Passed_5_AWS_Certifications_in_5_Days_15_Essential_Tips.html" rel="noopener noreferrer"&gt;...continue reading&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>certification</category>
    </item>
    <item>
      <title>Add Logging to AWS Lambda Without Redeploying Using a Simple Extension</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Tue, 19 Nov 2024 06:53:45 +0000</pubDate>
      <link>https://forem.com/serverlessl/add-logging-to-aws-lambda-without-redeploying-using-a-simple-extension-4o2f</link>
      <guid>https://forem.com/serverlessl/add-logging-to-aws-lambda-without-redeploying-using-a-simple-extension-4o2f</guid>
      <description>&lt;p&gt;&lt;strong&gt;A reusable extension for Node.js Lambda that logs requests and responses without code changes or redeployment. Learn how to use it and how I built it.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Challenge of Debugging AWS Lambda in Production
&lt;/h2&gt;

&lt;p&gt;Debugging Lambda functions in production can be challenging. Without sufficient logging, it’s often difficult to diagnose issues in the system. You could use some observability tools like Lumigo. You could also use Lambda Live Debugger with Observability mode. In most cases, you are mostly left to the mercy of the logs you have. However, excessive logging in high-traffic serverless applications can lead to high CloudWatch costs.&lt;/p&gt;

&lt;p&gt;The ideal solution is temporarily enabling logging without redeploying your Lambda function. But what if you didn’t build logging in a way that would support that? Is there a way to introduce this additional logging?&lt;/p&gt;

&lt;p&gt;Fortunately, there is. Using this Lambda extension, you can add it to any Lambda function, even in production environments, with minimal impact on your system. It supports Lambda based on Nodej.js.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Debug smarter, not harder! 🔧 A Lambda extension to log requests and responses without redeployment 💪&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The extension was originally developed as part of &lt;a href="https://www.lldebugger.com" rel="noopener noreferrer"&gt;Lambda Live Debugger&lt;/a&gt; and a &lt;a href="https://serverlessspy.com" rel="noopener noreferrer"&gt;ServerlessSpy&lt;/a&gt; tool. &lt;a href="https://www.lldebugger.com" rel="noopener noreferrer"&gt;Lambda Live Debugger&lt;/a&gt; is a tool that enables remote debugging of Lambda functions. It also speeds up development because you can avoid constant and timely redeploys. &lt;a href="https://serverlessspy.com" rel="noopener noreferrer"&gt;ServerlessSpy&lt;/a&gt; is a CDK-based library for writing elegant integration tests on AWS serverless architecture. It has an additional web console to monitor events in real-time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/Query_DynamoDB_with_SQL_using_Athena_Leveraging_DynamoDB_Exports_to_S3_1_2.html" rel="noopener noreferrer"&gt;&lt;strong&gt;...continue reading&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>lambda</category>
      <category>serverless</category>
      <category>aws</category>
    </item>
    <item>
      <title>Query DynamoDB with SQL using Athena - Leveraging EventBridge Pipes and Firehose (2/2)</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Mon, 11 Nov 2024 12:58:05 +0000</pubDate>
      <link>https://forem.com/serverlessl/query-dynamodb-with-sql-using-athena-leveraging-eventbridge-pipes-and-firehose-22-586p</link>
      <guid>https://forem.com/serverlessl/query-dynamodb-with-sql-using-athena-leveraging-eventbridge-pipes-and-firehose-22-586p</guid>
      <description>&lt;p&gt;&lt;strong&gt;With the help of EventBridge Pipes and Firehose, you can export DynamoDB data to S3 in near real-time, enabling you to query it using SQL via Athena.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the second part of a two-part series covering how to copy data from DynamoDB to S3 and query it with Athena.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="//./Query_DynamoDB_with_SQL_using_Athena_Leveraging_DynamoDB_Exports_to_S3_1_2.html"&gt;Part 1: Query DynamoDB with SQL using Athena - Leveraging DynamoDB Exports to S3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Part 2 (this article): Query DynamoDB with SQL using Athena - Leveraging EventBridge Pipes and Firehose&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;DynamoDB is a highly scalable NoSQL database, but it has limited query capabilities like any NoSQL database. By exporting data to S3 and querying it with Athena using SQL, we can combine the scalability of DynamoDB with the flexibility of SQL queries. This offers a truly serverless approach to SQL queries.&lt;/p&gt;

&lt;p&gt;The solution is built using CDK and TypeScript. It covers both single- and multiple-table designs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-Time Data Flow to S3
&lt;/h2&gt;

&lt;p&gt;&lt;a href="//./Query_DynamoDB_with_SQL_using_Athena_Leveraging_DynamoDB_Exports_to_S3_1_2.html"&gt;In Part 1, we explored how to use DynamoDB's native export to S3&lt;/a&gt;. While that works well for certain use cases, it falls short when you need near-real-time data. In Part 2, we’ll demonstrate a solution to stream new DynamoDB data to S3 in near real-time using EventBridge Pipes and Firehose.&lt;/p&gt;

&lt;p&gt;An added advantage of using Firehose over DynamoDB’s native export feature is that Firehose can convert the data to efficient formats, such as Parquet, which optimizes both storage and Athena query performance. You can also filter the data, so not all records need to be exported.&lt;/p&gt;

&lt;h2&gt;
  
  
  Downsides and Considerations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Delay&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Exporting DynamoDB data via EventBridge Pipes and Firehose, we can achieve real-time data storage in S3, albeit with some delay. How much delay depends on which batching configuration you set on Firehose. Firehose batch the data to store multiple records into one file. This is beneficial regarding cost, and most of all, it is great for Athena because it performs better when working with larger files.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Append-Only Nature&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Data in S3 is stored in an append-only format. If a record is deleted in DynamoDB, it won’t be removed from S3. Instead, you will need to store a record with a “deleted” flag and adjust your queries to account for this. Similarly, updates in DynamoDB are stored as new records, meaning that your Athena queries must be designed to retrieve the latest version of a record, which can add complexity. Those kinds of queries could be slow and expensive. But Athena is cheap, so this is not a problem if you do not have terabytes of data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Duplicate Records&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There’s no guarantee that data transferred to S3 will not duplicate records. EventBridge Pipes and Firehose do not ensure exactly-once delivery, so some records may be duplicated. Athena appears like an SQL database, but it is not. It has no constraints on the primary key, as you would subconsciously expect. And the whole process of transferring data is not idempotent, which means that it can produce duplicates. So, on most aggregate queries, you will need to use a DISTINCT SQL statement or similar approach.&lt;/p&gt;

&lt;p&gt;While Athena is cost-effective, handling duplicate records or complex queries may lead to performance trade-offs, especially with large datasets.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/Query_DynamoDB_with_SQL_using_Athena_Leveraging_EventBridge_Pipes_and_Firehose_2_2.html" rel="noopener noreferrer"&gt;&lt;strong&gt;...continue reading&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>dynamodb</category>
      <category>athena</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Query DynamoDB with SQL using Athena - Leveraging DynamoDB Exports to S3 (1/2)</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Tue, 05 Nov 2024 06:56:21 +0000</pubDate>
      <link>https://forem.com/serverlessl/query-dynamodb-with-sql-using-athena-leveraging-dynamodb-exports-to-s3-12-3n5c</link>
      <guid>https://forem.com/serverlessl/query-dynamodb-with-sql-using-athena-leveraging-dynamodb-exports-to-s3-12-3n5c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Export DynamoDB to S3 and query with Athena using SQL, unlocking powerful, scalable, and serverless data analytics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the first part of a two-part series covering how to copy data from DynamoDB to S3 and query it with Athena.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Part 1 (this article): Query DynamoDB with SQL using Athena - Leveraging DynamoDB Exports to S3&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Query_DynamoDB_with_SQL_using_Athena_Leveraging_DynamoDB_Exports_to_S3_1_2.html" rel="noopener noreferrer"&gt;Part 2: Query DynamoDB with SQL using Athena - Leveraging EventBridge Pipes and Firehose&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will build two solutions using AWS CDK and TypeScript, covering both single-table and multiple-table designs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Unlocking New Possibilities
&lt;/h2&gt;

&lt;p&gt;The DynamoDB is a NoSQL database, and that fact comes with both the good and the bad. Among others, the good is that it is ultimately scalable; the bad is that it has limited query capabilities. You can squeeze out some additional query capabilities with a &lt;a href="//./DynamoDB_Design_Patterns_for_Single_Table_Design.html"&gt;single-table approach&lt;/a&gt;, but it is still not comparable to any SQL database. However, for reporting, the SQL query language is extremely useful or almost essential.&lt;/p&gt;

&lt;p&gt;One option is to copy data to an SQL database and execute queries there. However, if the database is large, this can be impractical or too expensive. A more scalable solution is to transfer data to S3 and query it with Athena using SQL, which we will explore in this article.&lt;/p&gt;

&lt;p&gt;This approach is ideal for serverless solutions where the amount of data or cost makes an SQL database impractical. Athena is a powerful alternative and can be very cost-effective. At $5 per terabyte of queried data, it is significantly cheaper than provisioning an SQL instance capable of handling that volume. However, if you're running many queries, Athena may become expensive. Athena is best for creating offline reports. It's usually too slow for direct synchronous responses to users.&lt;/p&gt;

&lt;p&gt;There are several ways to copy data from DynamoDB to S3, but the most useful and serverless-friendly are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using native full or incremental exports from DynamoDB to S3&lt;/li&gt;
&lt;li&gt;Using EventBridge Pipes and Firehose for a near real-time copy of the data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This article focuses on the first approach. The second approach will be covered in Part 2. We will look at both solutions in the context of single-table and multiple-table designs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/Query_DynamoDB_with_SQL_using_Athena_Leveraging_DynamoDB_Exports_to_S3_1_2.html" rel="noopener noreferrer"&gt;&lt;strong&gt;...continue reading&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>dynamodb</category>
      <category>athena</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Serverless Developer Experience is Finally Great with Lambda Live Debugger</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Mon, 30 Sep 2024 18:27:03 +0000</pubDate>
      <link>https://forem.com/serverlessl/serverless-developer-experience-is-finally-great-with-lambda-live-debugger-5d8g</link>
      <guid>https://forem.com/serverlessl/serverless-developer-experience-is-finally-great-with-lambda-live-debugger-5d8g</guid>
      <description>&lt;h2&gt;
  
  
  Lambda Live Debugger allows you to remotely debug AWS Lambda functions, eliminating the need for time-consuming redeployment.
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://www.lldebugger.com" rel="noopener noreferrer"&gt;Lambda Live Debugger&lt;/a&gt; is an open-source tool that redefines serverless development by simplifying the debugging process for AWS Lambda functions. It allows developers to debug deployed Lambda functions locally, eliminating the need for redeployment and streamlining the entire workflow. With support for JavaScript, TypeScript, and numerous frameworks, Lambda Live Debugger addresses the challenges of the traditional serverless development cycle, enabling developers to bypass the tedious process of writing, deploying, and testing code, all while maintaining the same IAM permissions as if the code were running in the cloud.&lt;/p&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;

&lt;p&gt;Lambda Live Debugger connects your deployed Lambda functions to your local machine through AWS IoT. It intercepts requests, routes them to your local environment for debugging, and sends responses back to the deployed Lambda. This means you can inspect and interact with your Lambda function in real-time while it remains fully integrated with its cloud environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwr8cjuiyi1hb6kizt27f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwr8cjuiyi1hb6kizt27f.png" alt="Architecture"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In case of code changes, the tool automatically reloads the updated code without the need to redeploy or restart the debugger. TypeScript functions are automatically transpiled into JavaScript and run via Node Worker Threads.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Easiest Way to Configure: The Wizard
&lt;/h2&gt;

&lt;p&gt;One of the most convenient features of Lambda Live Debugger is its easy configuration process through the interactive wizard. Running the wizard configures key parameters such as AWS profile, region, and more with a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lld &lt;span class="nt"&gt;-w&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The wizard automatically generates a configuration file (&lt;code&gt;lldebugger.config.ts&lt;/code&gt;) and even sets up your debugging environment in VSCode with the necessary launch configurations in &lt;code&gt;.vscode/launch.json&lt;/code&gt;. This ensures that you can jump straight into debugging without manual configuration steps.&lt;/p&gt;

&lt;p&gt;You can now press F5 in VSCode to start debugging, set breakpoints, and inspect variables.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9fernrnk72sn78g3wj6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft9fernrnk72sn78g3wj6.png" alt="Debugging"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fast Switching Between Development Modes
&lt;/h2&gt;

&lt;p&gt;With Lambda Live Debugger, switching between active debugging and regular execution is incredibly fast. Simply run the following command to remove the debugger:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;lld &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This detaches the debugger from your Lambda functions, allowing you to quickly resume normal operation. Turning the debugging mode back on is just as fast. In comparison, alternative solutions often require a full redeployment, wasting valuable time and resources.&lt;/p&gt;

&lt;h2&gt;
  
  
  Focus on Specific Lambdas
&lt;/h2&gt;

&lt;p&gt;Another powerful feature is the ability to attach the debugger to only certain Lambda functions. This targeted approach allows you to concentrate solely on the part of your system you’re currently working on or experiencing issues with. By avoiding the distraction of unrelated functions, you can work more efficiently and effectively resolve problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Observability Mode
&lt;/h2&gt;

&lt;p&gt;In serverless development, developers typically work in personal environments to avoid affecting shared environment. However, if this isn’t feasible due to organizational or technical constraints, Observability Mode offers a perfect alternative.&lt;/p&gt;

&lt;p&gt;With Observability Mode, you can debug AWS Lambda functions without interrupting their normal operation. This mode intercepts requests and sends them to your local machine for inspection, while the Lambda continues running in the cloud as usual. The response from your machine is ignored. It's ideal for debugging in production or shared environments where you can't modify code or pause execution.&lt;/p&gt;

&lt;p&gt;Lambda Live Debugger samples requests at regular intervals (default is every 3 seconds) to prevent system overload, enabling real-time observation without impacting performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Supporting Any Framework
&lt;/h2&gt;

&lt;p&gt;Lambda Live Debugger out of the box supports CDK, Serverless Framework v3, AWS Serverless Application Model (SAM) and Terraform. It is also flexible enough to work with any custom setup. You can customize or provide your own list of Lambdas by modifying &lt;code&gt;lldebugger.config.ts&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;...&lt;/span&gt;
  &lt;span class="na"&gt;getLambdas&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;foundLambdas&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="c1"&gt;// function name as deployed on AWS&lt;/span&gt;
          &lt;span class="na"&gt;functionName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mystack-myfunction&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="na"&gt;codePath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/src/myLambda.ts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;];&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;satisfies&lt;/span&gt; &lt;span class="nx"&gt;LldConfigTs&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>lambda</category>
      <category>serverless</category>
      <category>aws</category>
    </item>
    <item>
      <title>CDK Escape Hatches + How to Export CDK to CloudFormation</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Wed, 18 Oct 2023 05:10:11 +0000</pubDate>
      <link>https://forem.com/serverlessl/cdk-escape-hatches-how-to-export-cdk-to-cloudformation-49pa</link>
      <guid>https://forem.com/serverlessl/cdk-escape-hatches-how-to-export-cdk-to-cloudformation-49pa</guid>
      <description>&lt;h2&gt;
  
  
  We will look at CDK escape hatches, including the ultimate one: exporting to independent CloudFormation.
&lt;/h2&gt;

&lt;p&gt;In the &lt;a href="//Tips_and_Tricks_for_Developing_CDK_Construct_using_Projen.html"&gt;previous article&lt;/a&gt;, we built a CDK construct. However, we also want the solution to be functional on its own as a CloudFormation template. This way, you do not have to incorporate the solution into your stack. You deploy a new one and point to the existing SNS topic you use for CloudWatch Alarm notification. &lt;strong&gt;We do not want to write CloudFormation from scratch but to reuse the CloudFormation that CDK produces.&lt;/strong&gt; In this article, we will look at how to convert CDK to clean CloudFormation without CDK metadata and the weird naming that CDK produces. Along the way, we will learn some really useful CDK tricks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why convert to CloudFormation and ship independently of CDK?
&lt;/h2&gt;

&lt;p&gt;There are multiple reasons why people may prefer exported CloudFormation over CDK.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reuse already-built constructs/solutions&lt;/strong&gt;. That is our reason.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CDK has some &lt;a href="https://blog.symphonia.io/posts/2022-06-07_cdk_good_bad_scary" rel="noopener noreferrer"&gt;obvious downsides&lt;/a&gt;&lt;/strong&gt;, and having an escape hatch of converting CloudFormation can be useful.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Culture war with (Dev)Ops guys&lt;/strong&gt;. The real developers, some would say, write every line of CloudFormation by themselves. Anything else is “unworthy of the title developer.”&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The requirement is to produce CloudFormation&lt;/strong&gt;, but the speed of the development with CDK is unmatched.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;I highly discourage having a default solution that converts CDK to CloudFormation.&lt;/strong&gt; That should be the last escape hatch. CDK brings a lot of benefits and features, and a lot of them cannot be replicated by just converting to CloudFormation. If the “culture war” is the cause of this approach, it would be better to sit down with the opposite side and do an unbiased evaluation of each approach. The end goal is to build a good product with the least resources and not to win culture wars.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We can export to CloudFormation like this:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cdk synth &amp;gt; my_cloudformation.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You do not need anything else. But this approach has several issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CloudFormation has a lot of CDK metadata.&lt;/li&gt;
&lt;li&gt;Logical names have random characters in the postfix.&lt;/li&gt;
&lt;li&gt;Assets are not dropped to any appropriate S3. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In our case, we also want to extend CloudFormation with CloudFormation parameters for the ARN of the SNS topic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/CDK_Escape_Hatches_How_to_Export_CDK_to_CloudFormation.html" rel="noopener noreferrer"&gt;Continue reading on www.serverlesslife.com...&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>cdk</category>
      <category>cloudformation</category>
    </item>
    <item>
      <title>Tips and Tricks for Developing CDK Construct using Projen</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Wed, 11 Oct 2023 05:36:06 +0000</pubDate>
      <link>https://forem.com/serverlessl/tips-and-tricks-for-developing-cdk-construct-using-projen-43d9</link>
      <guid>https://forem.com/serverlessl/tips-and-tricks-for-developing-cdk-construct-using-projen-43d9</guid>
      <description>&lt;h2&gt;
  
  
  Projen is an essential tool for creating CDK constructs. But it is opinionated. We will look into tips and tricks on how to overcome its constraints.
&lt;/h2&gt;

&lt;p&gt;Projen is a multipurpose project generator. Among other things, it can be used for building a CDK construct.&lt;/p&gt;

&lt;p&gt;Why would you need a special tool like Projen for creating a CDK construct? &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Creating a CDK construct is as easy as extending a Construct class:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LambdaErrorSnsSender&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Construct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;  &lt;/span&gt;&lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Construct&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;LambdaErrorSnsSenderProps&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="err"&gt;    &lt;/span&gt;&lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="err"&gt;  &lt;/span&gt;  &lt;span class="err"&gt;…&lt;/span&gt;
&lt;span class="err"&gt;  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are building a CDK construct that you intend to use in the same solution, you do not need anything else. But if you want to ship the construct to open source repos: Npm, Maven, Pypi, Nuget, or Go, you must transpile your code construct from TypeScript to other languages, package them, and deploy them to the desired repo. And you would need to do that in CI/CD. &lt;strong&gt;This is where &lt;a href="https://projen.io" rel="noopener noreferrer"&gt;Projen&lt;/a&gt; comes in. It sets up the whole environment with all the features and bells and whistles that you may need.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Projen provides the following features when &lt;a href="https://projen.io/awscdk-construct.html" rel="noopener noreferrer"&gt;building a CDK construct&lt;/a&gt;:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Compile, lint, and test the code.&lt;/li&gt;
&lt;li&gt;Use &lt;a href="https://github.com/aws/jsii" rel="noopener noreferrer"&gt;JSII&lt;/a&gt; to produce library artifacts for all target languages.&lt;/li&gt;
&lt;li&gt;Determine the next minor/patch version based on &lt;a href="https://www.conventionalcommits.org/" rel="noopener noreferrer"&gt;conventional commits&lt;/a&gt;. &lt;/li&gt;
&lt;li&gt;A changelog entry is generated based on the commit history.&lt;/li&gt;
&lt;li&gt;Packages are published to all target package managers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/Tips_and_Tricks_for_Developing_CDK_Construct_using_Projen.html" rel="noopener noreferrer"&gt;Continue reading on www.serverlesslife.com...&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Improving CloudWatch Alarms for Lambda Errors</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Wed, 04 Oct 2023 05:44:03 +0000</pubDate>
      <link>https://forem.com/serverlessl/improving-cloudwatch-alarms-for-lambda-errors-g3g</link>
      <guid>https://forem.com/serverlessl/improving-cloudwatch-alarms-for-lambda-errors-g3g</guid>
      <description>&lt;h2&gt;
  
  
  A simple solution to improve the CloudWatch alarm to receive Lambda error details by email. Available as CDK construct or as CloudFormation.
&lt;/h2&gt;

&lt;p&gt;AWS CloudWatch is not the best service for monitoring your system. It has a ton of features, but many of them are awkward to use. But at the same time, it is baked into AWS, and you do not have to look for something else. And for a large number of solutions, it is good enough.&lt;/p&gt;

&lt;p&gt;One of the not-so-nice things is notifying of Lambda errors. Typically, you would attach an Alarm to the Lambda error metric. The Alarm would send a message to SNS, which would send it to your email or SMS. That is a relatively common way, but not the only one. One benefit of this approach is that you do not get a ton of messages. You just get one for the Alarm being in the error state.&lt;/p&gt;

&lt;p&gt;But this notification does not contain any details on an error. &lt;strong&gt;You will have to open the AWS console, find the appropriate log group, open CloudWatch Logs Insights, write a query, and after a few minutes, you will have your error message, which quite possibly is an unimportant one-time occurrence of some timeout.&lt;/strong&gt; Of course, you can simplify this process, but wouldn't it be great to get a sample of errors by email? Most of the systems for monitoring and logging, like Sentry, provide that out of the box.&lt;/p&gt;

&lt;p&gt;I will present a simple solution for getting error messages by email. It is great for smaller projects when you do not want to configure other error-logging solutions or for older systems where you do not wish to alter them just because of that.&lt;/p&gt;

&lt;p&gt;The solution is in two forms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://constructs.dev/packages/lambda-error-sns-sender" rel="noopener noreferrer"&gt;CDK construct&lt;/a&gt;&lt;/strong&gt;
If you are building your system with CDK (or &lt;a href="https://sst.dev/" rel="noopener noreferrer"&gt;SST&lt;/a&gt;). Available for TypeScript, Java, C#, Python, and Go.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://lambda-error-sns-sender.s3.eu-west-1.amazonaws.com/lambda-error-sns-sender.yaml" rel="noopener noreferrer"&gt;CloudFormation&lt;/a&gt;&lt;/strong&gt;
For existing solutions, so you do not have to modify them. You deploy and point to the existing SNS used for CloudWatch alarms.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How does it work?&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Lambda is subscribed to the SNS topic where you receive your alarms.&lt;/strong&gt; There is a message body subscription filter that limits errors based on the Lambda error metric. You must change the filter if you defied your metric in some other way, not the default one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda analyzes the message&lt;/strong&gt;, finds a log of the failed Lambda, and queries the log group for the period that the metric was configured, plus some additional safety time, so we do not miss that error message. It extracts just a number of errors that can fit in one SNS message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda sends errors to the same SNS&lt;/strong&gt; that you use for alerts. So, apart from the Alarm message for changing the error state, you will receive an additional one with detailed error messages.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwh3twrdhnqnc9htx13xf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwh3twrdhnqnc9htx13xf.png" alt="lambda-error-sns-sender" width="503" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.serverlesslife.com/Improving_CloudWatch_Alarms_for_Lambda_Errors.html" rel="noopener noreferrer"&gt;Continue reading on www.serverlesslife.com…&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>cloudwatch</category>
      <category>lambda</category>
    </item>
    <item>
      <title>ServerlessSpy—Gain Insight into the Cloud and Write Serverless Tests with Ease </title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Tue, 26 Sep 2023 05:40:25 +0000</pubDate>
      <link>https://forem.com/serverlessl/serverlessspy-gain-insight-into-the-cloud-and-write-serverless-tests-with-ease-1gfl</link>
      <guid>https://forem.com/serverlessl/serverlessspy-gain-insight-into-the-cloud-and-write-serverless-tests-with-ease-1gfl</guid>
      <description>&lt;p&gt;ServerlessSpy is a CDK-based library for writing integration tests on AWS serverless, and it comes with a web console to monitor events in real time.&lt;/p&gt;

&lt;p&gt;Writing tests for serverless is challenging. Unit tests often do not provide much value because all services need to be mocked. Integration tests that run on the real cloud infrastructure are the preferred way to test such a system. But integration tests are hard to write, and they are slow to execute. A serverless system is usually built as an asynchronous event-driven system. That means that you put an event in on one side, and after some time, you get some output on the other side. You do not know when, so you have to keep checking. That is slow. At the same time, no other tests can usually run because they will mess up your data. The last issue is that you often have to save the message in some storage just for the integration test to be able to inspect the message.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That's why I created a &lt;a href="https://serverlessspy.com/" rel="noopener noreferrer"&gt;ServerlessSpy&lt;/a&gt;, which resolves the problems mentioned above.&lt;/strong&gt; It provides a CDK construct that creates infrastructure to intercept events in Lambda, SNS, SQS, EventBridge, DynamoDB, and S3, and sends it to a testing library via API Gateway WebSocket. The testing library subscribes to events so that tests can be executed fast without checking/retrying if the process has finished. You do not have to build additional infrastructure to temporarily store the events. Tests can also run in parallel because you can filter events to receive only the ones meant for your test case.&lt;/p&gt;

&lt;p&gt;ServerlessSpy can be used for more than writing integration tests. A special web console can receive events from WebSocket. &lt;strong&gt;The console enables you to inspect events in real time and see what is happening in the cloud.&lt;/strong&gt; Some say it is even more useful than the part for writing integration tests.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Writing integration tests for #serverless used to be a tedious job. #ServerlessSpy with the magic of #CDK and #TypeScript makes writing integration tests fast and pleasant.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Key benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Easy to write tests that are strongly typed thanks to TypeScript.&lt;/li&gt;
&lt;li&gt;Tests are executed much FASTER. No need to write tests in a way to periodically check if the process has finished because all events are pushed to the testing library.&lt;/li&gt;
&lt;li&gt;Tests can run in parallel if you use conditions and filter events specific to your test. This drastically reduces the execution time of the CI/CD process.&lt;/li&gt;
&lt;li&gt;Web console enables you to see all events in real time. Debugging has never been easier. Search for events is also supported (with regular expression).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/ServerlessSpy_Gain_Insight_into_the_Cloud_and_Write_Serverless_Tests_with_Ease.html" rel="noopener noreferrer"&gt;Continue reading on www.serverlesslife.com...&lt;/a&gt;&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>aws</category>
      <category>testing</category>
    </item>
    <item>
      <title>OpenAPI + Zod + API Gateway + SST = Turbo Productivity</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Wed, 20 Sep 2023 06:37:33 +0000</pubDate>
      <link>https://forem.com/serverlessl/openapi-zod-api-gateway-sst-turbo-productivity-1349</link>
      <guid>https://forem.com/serverlessl/openapi-zod-api-gateway-sst-turbo-productivity-1349</guid>
      <description>&lt;h2&gt;
  
  
  How to boost productivity with OpenAPI schema, Zod library, and client-generated code. Included is a sample serverless app built with SST/CDK.
&lt;/h2&gt;

&lt;p&gt;"Don't repeat yourself" (DRY) is one of the main principles of software development. But we keep on breaking it by &lt;strong&gt;rewriting the data structure on each layer&lt;/strong&gt;. In this article, we'll explore the method of enhancing our productivity through the utilization of OpenAPI schema, the Zod library, and the generation of client code, all aimed at reusing our types, schemas, and structures. l will bundle everything into a sample AWS serverless application built with the &lt;a href="https://sst.dev/" rel="noopener noreferrer"&gt;SST framework&lt;/a&gt; (which uses CDK). The solution also takes into account that you do not want to have exactly the same types everywhere. The Zod library nicely solves the problem and allows you to mix and match types.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&amp;gt; We keep breaking the "Don't repeat yourself" (DRY) principle by rewriting the data structure on each layer.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When you are creating an API and an application that consumes it, you need to (re)create types/schema for each layer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;data exchange = OpenAPI, GraphQL&lt;/li&gt;
&lt;li&gt;client that consume it&lt;/li&gt;
&lt;li&gt;API validation logic&lt;/li&gt;
&lt;li&gt;business logic&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.serverlesslife.com/OpenAPI_Zod_API_Gateway_SST_Turbo_Productivity.html" rel="noopener noreferrer"&gt;Continue reading on www.serverlesslife.com...&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>serverless</category>
      <category>openapi</category>
      <category>zod</category>
    </item>
  </channel>
</rss>
