<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Layers on {O}</title>
    <link>https://omarmakled.com/tags/layers/</link>
    <description>Recent content in Layers on {O}</description>
    <generator>Hugo -- 0.151.1</generator>
    <language>en-us</language>
    <atom:link href="https://omarmakled.com/tags/layers/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Organize AWS Lambda Projects with Nested Stacks and Layers in SAM</title>
      <link>https://omarmakled.com/posts/sam-layer/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://omarmakled.com/posts/sam-layer/</guid>
      <description>&lt;p&gt;This example shows how to build a &lt;strong&gt;modular AWS Lambda project&lt;/strong&gt; using &lt;strong&gt;SAM (Serverless Application Model)&lt;/strong&gt; with &lt;strong&gt;nested stacks&lt;/strong&gt; and a &lt;strong&gt;shared layer&lt;/strong&gt;. This helps keep your project clean and organized by separating logic and shared dependencies.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&#34;how-it-works&#34;&gt;How It Works&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;layer.yaml&lt;/code&gt;&lt;/strong&gt; creates a shared Lambda Layer that contains Node.js packages (like &lt;code&gt;axios&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;order.yaml&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;log.yaml&lt;/code&gt;&lt;/strong&gt; are two Lambda functions that use this shared layer.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;root template (&lt;code&gt;template.yaml&lt;/code&gt;)&lt;/strong&gt;:
&lt;ul&gt;
&lt;li&gt;Creates the layer stack.&lt;/li&gt;
&lt;li&gt;Passes the layer reference to the other stacks as a parameter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sam build
&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;sam deploy --guided
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;strong&gt;Project Repository:&lt;/strong&gt; &lt;a href=&#34;https://github.com/OmarMakled/sam-nested-layer&#34;&gt;https://github.com/OmarMakled/sam-nested-layer&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
