<?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>DEV Community: Marko - ServerlessLife.com</title>
    <description>The latest articles on DEV Community by Marko - ServerlessLife.com (@serverlessl).</description>
    <link>https://dev.to/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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F510944%2F328de472-114f-4399-9e77-5718a19a0e43.png</url>
      <title>DEV Community: Marko - ServerlessLife.com</title>
      <link>https://dev.to/serverlessl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/serverlessl"/>
    <language>en</language>
    <item>
      <title>Building an E-commerce AI Agent with AWS Serverless: Choosing the Right Runtime (2/7)</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Thu, 12 Nov 2026 15:01:16 +0000</pubDate>
      <link>https://dev.to/serverlessl/building-an-e-commerce-ai-agent-with-aws-serverless-choosing-the-right-runtime-27-516f</link>
      <guid>https://dev.to/serverlessl/building-an-e-commerce-ai-agent-with-aws-serverless-choosing-the-right-runtime-27-516f</guid>
      <description>&lt;p&gt;&lt;strong&gt;Compare AWS Lambda Event, Lambda Web Functions, and AgentCore Runtime using real performance and cost measurements.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article is part of the &lt;strong&gt;Building an E-commerce AI Agent with AWS Serverless&lt;/strong&gt; series:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_1_Understanding_AI_Agents.html" rel="noopener noreferrer"&gt;Understanding AI Agents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_2_Choosing_the_Right_Runtime.html" rel="noopener noreferrer"&gt;Choosing the Right Runtime&lt;/a&gt;&lt;/strong&gt; (here)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_3_Building_Product_Search_and_RAG.html" rel="noopener noreferrer"&gt;Building Product Search and RAG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_4_Conversation_Memory_and_Context_Management.html" rel="noopener noreferrer"&gt;Conversation Memory and Context Management&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_5_Connecting_the_Agent_to_Your_Webshop.html" rel="noopener noreferrer"&gt;Connecting the Agent to Your Webshop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_6_Security_Privacy_and_Observability.html" rel="noopener noreferrer"&gt;Security, Privacy, and Observability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_7_The_Sample_Application.html" rel="noopener noreferrer"&gt;The Sample Application&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Source code: &lt;a href="https://github.com/ServerlessLife/ecommerce-ai-agent" rel="noopener noreferrer"&gt;https://github.com/ServerlessLife/ecommerce-ai-agent&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Building an AWS Serverless AI Agent
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why serverless?
&lt;/h3&gt;

&lt;p&gt;The usual reasons for choosing serverless still apply to AI agents:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pay only for what you use&lt;/li&gt;
&lt;li&gt;Autoscale&lt;/li&gt;
&lt;li&gt;No servers or containers to manage&lt;/li&gt;
&lt;li&gt;High availability&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But there is an even more important reason. In recent years, AWS has built a wide range of services specifically for developing and running AI agents. Most of the components we need are already available, allowing us to build solutions much faster.&lt;/p&gt;

&lt;p&gt;Is serverless expensive? For a regular serverless project, the answer is that it is usually cheaper if you count the total cost of ownership. But here the answer is different. LLM costs will likely be much higher than the cost of running the agent itself. So the price is not that important.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But what matters much more is fast time to market.&lt;/strong&gt; Imagine building 100 prototypes, but only one succeeds. With serverless, you would pay almost nothing for the projects that failed. You would pay only for the one that succeeded.&lt;/p&gt;

&lt;p&gt;That's the real power of serverless: building and testing ideas faster, with minimal upfront costs, and scaling only the ones that succeed.&lt;/p&gt;

&lt;h3&gt;
  
  
  Picking a runtime
&lt;/h3&gt;

&lt;p&gt;AWS offers three serverless options for running a custom AI agent: traditional AWS Lambda (Lambda Event), Lambda Web Functions, and Amazon Bedrock AgentCore Runtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Classic Lambda Event Function billing is optimized for fast responses with high CPU usage. But AI agents are the opposite. They are slow because LLMs are slow, and they don't use much CPU because they mostly just stream the LLM response.&lt;/strong&gt; That's why it's so important that AgentCore and Lambda Web Functions have separate CPU and memory billing.&lt;/p&gt;

&lt;h4&gt;
  
  
  AWS Lambda Event
&lt;/h4&gt;

&lt;p&gt;Traditional AWS Lambda is the simplest option. Each invocation runs the agent, handles LLM and tool calls, and returns a response. Streaming is supported through Lambda Function URLs or compatible API Gateway REST API integrations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The main limitation is billing.&lt;/strong&gt; Lambda charges for configured memory over the entire invocation duration, including time spent waiting for external services. CPU allocation is proportional to configured memory. For example, if our agent takes 10 seconds to answer but spends 8 seconds waiting for an LLM, we still pay for all 10 seconds.&lt;/p&gt;

&lt;p&gt;Each concurrent invocation needs a separate execution environment. AWS may reuse environments between requests, but we cannot rely on this to preserve conversation state. We therefore need external storage for conversation history.&lt;/p&gt;

&lt;p&gt;Lambda has a maximum invocation duration of 15 minutes.&lt;/p&gt;

&lt;p&gt;Despite these limitations, Lambda Event is often the cheapest option for short, occasional requests. It is also an excellent choice for background tasks such as ingestion, embedding generation, and data processing.&lt;/p&gt;

&lt;h4&gt;
  
  
  AWS Lambda Web Functions
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Unlike traditional Lambda, Lambda Web separates CPU and memory billing.&lt;/strong&gt; Each execution environment has 2 Arm64 vCPUs and up to 2 GB of memory. We pay for the CPU time the application and runtime actively consume, not for CPU time spent waiting for an LLM or external API. Memory is billed based on consumption over the lifetime of the execution environment, including idle time between requests. Requests and data transfer are charged separately.&lt;/p&gt;

&lt;p&gt;Another important advantage is concurrency. A single execution environment can handle multiple concurrent HTTP requests. While one conversation waits for an LLM response, the same environment can process other conversations.&lt;/p&gt;

&lt;p&gt;However, there are some limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Memory remains billable while the environment is active.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In my measurements, an environment remained alive for approximately six minutes after the last response, increasing costs. This duration is not documented by AWS.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conversation state still needs external storage because requests are not tied to dedicated environments.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Maximum request duration is 15 minutes.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lambda Web can be more cost-effective than traditional Lambda under sustained&lt;/strong&gt; concurrent workloads, especially when requests spend most of their time waiting for I/O. Actual savings depend on concurrency, memory consumption, and environment lifetime.&lt;/p&gt;

&lt;h4&gt;
  
  
  Amazon Bedrock AgentCore Runtime
&lt;/h4&gt;

&lt;p&gt;Amazon Bedrock AgentCore Runtime is designed specifically for AI agents. It offers two compute options: serverless microVMs and EC2-backed Instances.&lt;/p&gt;

&lt;h4&gt;
  
  
  AgentCore Runtime MicroVMs
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;With MicroVMs, each conversation session gets its own isolated execution environment, with dynamically&lt;/strong&gt; allocated resources up to 2 vCPUs and 8 GB of memory.&lt;/p&gt;

&lt;p&gt;AgentCore uses consumption-based billing with separate CPU and memory charges. When the agent waits for an LLM or tool and no background processing uses CPU, CPU charges can fall to zero.&lt;/p&gt;

&lt;p&gt;Memory is billed separately and includes the entire runtime environment, which is different comparing to Lambda Web Function.&lt;/p&gt;

&lt;p&gt;Stateful sessions are AgentCore's main advantage. The same process can remain alive between messages, allowing us to keep the Strands agent and conversation history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;By default, idle sessions terminate after 15 minutes, although this is configurable.&lt;/strong&gt; For our agent, reducing the timeout to a few minutes may significantly lower costs. The maximum session lifetime is 8 hours. Persistent storage is therefore still necessary to resume conversations after a session expires.&lt;/p&gt;

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

</description>
      <category>ai</category>
      <category>agents</category>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Building an E-commerce AI Agent with AWS Serverless: Understanding AI Agents (1/7)</title>
      <dc:creator>Marko - ServerlessLife.com</dc:creator>
      <pubDate>Wed, 04 Nov 2026 16:04:12 +0000</pubDate>
      <link>https://dev.to/serverlessl/building-an-e-commerce-ai-agent-with-aws-serverless-understanding-ai-agents-17-37db</link>
      <guid>https://dev.to/serverlessl/building-an-e-commerce-ai-agent-with-aws-serverless-understanding-ai-agents-17-37db</guid>
      <description>&lt;p&gt;&lt;strong&gt;How AI agents work, from basic chatbots to tool-calling agents, including product search, RAG, and reranking.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article is part of the &lt;strong&gt;Building an E-commerce AI Agent with AWS Serverless&lt;/strong&gt; series:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_1_Understanding_AI_Agents.html" rel="noopener noreferrer"&gt;Understanding AI Agents&lt;/a&gt;&lt;/strong&gt; (here)&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_2_Choosing_the_Right_Runtime.html" rel="noopener noreferrer"&gt;Choosing the Right Runtime&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_3_Building_Product_Search_and_RAG.html" rel="noopener noreferrer"&gt;Building Product Search and RAG&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_4_Conversation_Memory_and_Context_Management.html" rel="noopener noreferrer"&gt;Conversation Memory and Context Management&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_5_Connecting_the_Agent_to_Your_Webshop.html" rel="noopener noreferrer"&gt;Connecting the Agent to Your Webshop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_6_Security_Privacy_and_Observability.html" rel="noopener noreferrer"&gt;Security, Privacy, and Observability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.serverlesslife.com/Building_an_Ecommerce_AI_Agent_with_AWS_Serverless_Part_7_The_Sample_Application.html" rel="noopener noreferrer"&gt;The Sample Application&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Source code: &lt;a href="https://github.com/ServerlessLife/ecommerce-ai-agent" rel="noopener noreferrer"&gt;https://github.com/ServerlessLife/ecommerce-ai-agent&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What we are building
&lt;/h2&gt;

&lt;p&gt;We are building an AI-powered shopping assistant for an e-commerce website. It will provide a chat-based interface where visitors can find products, ask questions, and interact with the shop using natural language.&lt;/p&gt;

&lt;p&gt;Our goal is to integrate the assistant into an existing webshop with as few changes as possible, rather than rebuilding the website around AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the assistant will do
&lt;/h3&gt;

&lt;p&gt;The assistant should help visitors throughout their shopping journey:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Find products:&lt;/strong&gt; Understand what customers are looking for, even when they describe their needs rather than use exact product names.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answer product questions:&lt;/strong&gt; Explain product features, provide additional information, and help customers compare alternatives.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assist with shopping:&lt;/strong&gt; Help customers select products and add them to their cart.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Answer common questions:&lt;/strong&gt; Provide information about delivery, returns, and other shop-related topics.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Support registered customers:&lt;/strong&gt; Access relevant account information, such as past orders, and perform operations available to authenticated users.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The assistant will be available to both anonymous visitors and registered customers, with different capabilities depending on whether the user is authenticated.&lt;/p&gt;

&lt;p&gt;We also want to support non-English webshops. This is an important requirement because language affects our choice of LLM, embeddings, search and ranking techniques, and guardrails.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why build a shopping assistant?
&lt;/h3&gt;

&lt;p&gt;A conversational interface gives visitors another way to interact with an online shop. Instead of figuring out which keywords to enter or navigating through multiple product categories, customers can simply explain what they need.&lt;/p&gt;

&lt;p&gt;This can make product discovery easier, encourage exploration, and potentially improve the shopping experience.&lt;/p&gt;

&lt;p&gt;There is also the novelty factor. AI is still interesting to many customers, and a shopping assistant may attract attention simply because it offers something different from a traditional webshop.&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical considerations
&lt;/h3&gt;

&lt;p&gt;We want the assistant to be practical to integrate, operate, and maintain. A few requirements will influence our architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Minimal integration effort:&lt;/strong&gt; Add the assistant to an existing webshop without major changes to the application.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multilingual support:&lt;/strong&gt; Handle customer conversations and product information in languages other than English.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User context and permissions:&lt;/strong&gt; Distinguish between anonymous and authenticated customers, especially when accessing personal information or performing account-specific operations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cost control and abuse prevention:&lt;/strong&gt; Since the chat is publicly accessible and every LLM request costs money, we need to prevent individual users or bots from consuming resources without limits.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These requirements will guide the technical decisions we make throughout the series.&lt;/p&gt;

&lt;p&gt;Before choosing the architecture and implementation, let's look at how a simple chat interface can evolve into a more capable e-commerce AI agent.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evolution of an e-commerce AI agent
&lt;/h3&gt;

&lt;p&gt;We can build the experience in three stages, adding capability at each step.&lt;/p&gt;

&lt;h4&gt;
  
  
  A simple chat
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;The first version has a chat window, but it follows the same steps for every question.&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The customer asks a question in the chat.&lt;/li&gt;
&lt;li&gt;An embedding model converts the question into numbers (a vector).&lt;/li&gt;
&lt;li&gt;Vector search compares that vector with product embeddings prepared earlier in the product vector database.&lt;/li&gt;
&lt;li&gt;The search returns matching products.&lt;/li&gt;
&lt;li&gt;We send the question and matching products to an LLM, which writes an answer with product links.&lt;/li&gt;
&lt;li&gt;The answer is returned to the customer in the chat.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The LLM writes the answer, but does not choose what to search or call tools. Each message starts a fresh search, so it cannot understand “What about a cheaper one?” as a follow-up.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvywh6zcekbpico33e2uj.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvywh6zcekbpico33e2uj.png" alt="simple chat flow" width="722" height="654"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Improving chat
&lt;/h4&gt;

&lt;p&gt;Next, we improve the fixed path by rewriting questions and reranking search results.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The customer asks a question, such as “My feet get wet when I run in the rain. What should I buy?”&lt;/li&gt;
&lt;li&gt;An LLM rewrites the question as a better product search query, such as “waterproof running shoes.”&lt;/li&gt;
&lt;li&gt;We search the product vector database using the improved query.&lt;/li&gt;
&lt;li&gt;The search returns candidate products.&lt;/li&gt;
&lt;li&gt;We send those search results to a reranking model.&lt;/li&gt;
&lt;li&gt;The reranker compares the products with the query and selects the most suitable ones.&lt;/li&gt;
&lt;li&gt;We send the top products to an LLM to generate an answer.&lt;/li&gt;
&lt;li&gt;The answer is returned to the customer in the chat.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;There is still no conversation history at this stage.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F981v3lom3weef9quqknw.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F981v3lom3weef9quqknw.png" alt="improved chat with reranking" width="722" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  A real AI agent
&lt;/h4&gt;

&lt;p&gt;With a real agent, the LLM receives the conversation and decides which tools to call, rather than following a fixed sequence. It can understand follow-up questions like “What about a cheaper one?”, search for products, fetch details, or request an add-to-cart action. The harness executes tool calls and returns their results to the LLM until it can answer. We will explore how this works in more detail later.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcnmdyg6sh95gj9qc9uvb.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcnmdyg6sh95gj9qc9uvb.jpg" alt="tool calling ai agent flow" width="799" height="501"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How AI agents work
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;An AI agent repeatedly asks a large language model (LLM) what to do next.&lt;/strong&gt; The LLM can ask to use a tool. A tool is simply a function with a name and inputs. The agent's code, called a harness, runs the tool, sends the result back, and asks the LLM again. The loop stops when the LLM gives a final answer.&lt;/p&gt;

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

</description>
      <category>ai</category>
      <category>agents</category>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <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://dev.to/serverlessl/cdk-booster-speeding-up-bundling-of-lambda-handlers-4lgk</link>
      <guid>https://dev.to/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://dev.to/serverlessl/lambda-live-debugger-vs-official-aws-remote-debugging-1ae6</link>
      <guid>https://dev.to/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://dev.to/serverlessl/i-passed-5-aws-certifications-in-5-days-15-essential-tips-32po</link>
      <guid>https://dev.to/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://dev.to/serverlessl/add-logging-to-aws-lambda-without-redeploying-using-a-simple-extension-4o2f</link>
      <guid>https://dev.to/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://dev.to/serverlessl/query-dynamodb-with-sql-using-athena-leveraging-eventbridge-pipes-and-firehose-22-586p</link>
      <guid>https://dev.to/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://dev.to/serverlessl/query-dynamodb-with-sql-using-athena-leveraging-dynamodb-exports-to-s3-12-3n5c</link>
      <guid>https://dev.to/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://dev.to/serverlessl/serverless-developer-experience-is-finally-great-with-lambda-live-debugger-5d8g</link>
      <guid>https://dev.to/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://dev.to/serverlessl/cdk-escape-hatches-how-to-export-cdk-to-cloudformation-49pa</link>
      <guid>https://dev.to/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.&amp;nbsp;&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://dev.to/serverlessl/tips-and-tricks-for-developing-cdk-construct-using-projen-43d9</link>
      <guid>https://dev.to/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?&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&amp;nbsp;&lt;/span&gt;  &lt;span class="err"&gt;…&lt;/span&gt;
&lt;span class="err"&gt;&amp;nbsp;&amp;nbsp;&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;&amp;nbsp;&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;.&amp;nbsp;&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://dev.to/serverlessl/improving-cloudwatch-alarms-for-lambda-errors-g3g</link>
      <guid>https://dev.to/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&amp;nbsp;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>
  </channel>
</rss>
