<?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: chrishart0</title>
    <description>The latest articles on DEV Community by chrishart0 (@chrishart0).</description>
    <link>https://dev.to/chrishart0</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%2F708220%2Fafbe39a9-aed1-4c07-a732-68487e8c000a.png</url>
      <title>DEV Community: chrishart0</title>
      <link>https://dev.to/chrishart0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chrishart0"/>
    <language>en</language>
    <item>
      <title>NextJS 13 Hero Component – How to Use Next/Image for Cover</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Sun, 11 Jun 2023 16:05:07 +0000</pubDate>
      <link>https://dev.to/chrishart0/nextjs-13-hero-component-how-to-use-nextimage-for-cover-2m9j</link>
      <guid>https://dev.to/chrishart0/nextjs-13-hero-component-how-to-use-nextimage-for-cover-2m9j</guid>
      <description>&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%2Ftng6n8yed1ajsp0gelsd.jpg" 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%2Ftng6n8yed1ajsp0gelsd.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;br&gt;
See in the above example how my cover image looks. At the time of writing this, this page is &lt;a href="https://MyChefAI.com/diabetes" rel="noopener noreferrer"&gt;MyChefAI.com/diabetes&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Here is my full hero image component&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { styled } from "@mui/system";
import Link from "next/link";
import Image from 'next/image';

//MUI Components
import { Box, Button, Typography } from "@mui/material";

function DiabetesLandingHero({handleScroll}) {
  const HeroImage = styled("div")(({ theme }) =&amp;gt; ({
    position: "relative",
    height: "80vh",
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    overflow: "hidden",
    color: "white",
    textAlign: "center",
    textShadow: "1px 1px 3px rgba(0, 0, 0, 0.4)",
  }));

  const ImageOverlay = styled("div")(({ theme }) =&amp;gt; ({
    position: "absolute",
    top: 0,
    bottom: 0,
    right: 0,
    left: 0,
    backgroundColor: "rgba(0, 0, 0, 0.5)", // semi-transparent black overlay
  }));

  const TextContent = styled("div")(({ theme }) =&amp;gt; ({
    position: "relative",
    paddingTop: theme.breakpoints.up("md") ? "10vh" : "5vh",
    color: theme.palette.common.white,
    position:"relative",
    margin: theme.spacing(1),
    textShadow: "2px 2px 4px rgba(0, 0, 0, 0.5)", // text shadow
    display: "flex",
    alignItems: "center",
    justifyContent: "center",
    flexDirection: "column",
    height: "100%",
    zIndex: 1, // Added a z-index so that this div stays above the Image component
  }));

  return (
    &amp;lt;HeroImage&amp;gt;
      &amp;lt;Image
        src="/hero-image.webp"
        alt="Hero Image"
        priority={true} 
        loading='eager'
        fill
        style={{objectFit:"cover"}}
        quality={100}
      /&amp;gt;
      &amp;lt;ImageOverlay /&amp;gt;
      &amp;lt;TextContent&amp;gt;
        &amp;lt;Typography variant="h2" component="h1" sx={{ paddingBottom: "2vh", fontSize: (theme) =&amp;gt; theme.breakpoints.down('md') ? '2.5rem' : '3rem' }}&amp;gt;
          My Chef AI for Diabetes
        &amp;lt;/Typography&amp;gt;
        &amp;lt;Typography variant="h4" gutterBottom sx={{ fontSize: (theme) =&amp;gt; theme.breakpoints.down('md') ? '1.5rem' : '2rem' }}&amp;gt;
          Recipes crafted to your unique needs.
        &amp;lt;/Typography&amp;gt;
        &amp;lt;Typography variant="h6" sx={{ fontSize: (theme) =&amp;gt; theme.breakpoints.down('md') ? '1.2rem' : '1.5rem' }}&amp;gt;
          Managing Type 1 or 2 diabetes? Turn your dietary needs into tasty, tailored meals. Make your food work for you.
        &amp;lt;/Typography&amp;gt;
        &amp;lt;Link href="/chat" passHref&amp;gt;
          &amp;lt;Button
            variant="contained"
            size="large"
            sx={{ mt: 4, color: "primary.contrastText", fontSize: (theme) =&amp;gt; theme.breakpoints.down('md') ? '0.9rem' : '1.5rem' }}
          &amp;gt;
            Join &amp;amp; Start Cooking!
          &amp;lt;/Button&amp;gt;
        &amp;lt;/Link&amp;gt;
      &amp;lt;/TextContent&amp;gt;
      &amp;lt;Box
        sx={{
          position: "absolute",
          bottom: 8,
          left: "50%",
          transform: "translateX(-50%)",
          cursor: "pointer",
        }}
        onClick={handleScroll}
      &amp;gt;
      &amp;lt;/Box&amp;gt;
    &amp;lt;/HeroImage&amp;gt;
  );
}

export default DiabetesLandingHero;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How to use next/image for cover image&lt;/p&gt;

&lt;p&gt;As show in the codeblock above, how you can specifically use Next/Image as a cover is this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div style={{position:"relative"}}&amp;gt;
  &amp;lt;Image
      src='/cover.webp'
      fill
      style={{objectFit:"cover"}}
    /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code is from my new personal project &lt;a href="//MyChefAI.com/diabetes"&gt;MyChefAI.com/diabetes&lt;/a&gt;. A free tool for helping diabetics get better recipes.&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>nextjs13</category>
      <category>react</category>
    </item>
    <item>
      <title>Rescue Your Soul From AWS CDK Dependency Hell and Improve Your DevEx With 3 Musketeers</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Tue, 22 Feb 2022 19:14:17 +0000</pubDate>
      <link>https://dev.to/chrishart0/rescue-your-soul-from-aws-cdk-dependency-hell-and-improve-your-devex-with-3-musketeers-3lhd</link>
      <guid>https://dev.to/chrishart0/rescue-your-soul-from-aws-cdk-dependency-hell-and-improve-your-devex-with-3-musketeers-3lhd</guid>
      <description>&lt;p&gt;Cross post: &lt;a href="https://medium.com/p/4293815d01a8"&gt;Medium&lt;/a&gt; | &lt;a href="https://arcadian.cloud/aws/2022/02/22/make-your-life-easier-by-running-aws-cdk-in-a-docker-container/"&gt;Arcadian&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;GitHub Repo: &lt;a href="https://github.com/chrishart0/aws-cdk-typescript-3-musketeers"&gt;https://github.com/chrishart0/aws-cdk-typescript-3-musketeers&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is an example of containerized AWS CDK following the 3 Musketeers pattern.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is This 3 Musketeers Thing Anyway and Why Would I Want to Do Such a Thing as to Containerize the AWS CDK?
&lt;/h2&gt;

&lt;p&gt;Links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;3 Musketeers for an epic Developer Experience&lt;/li&gt;
&lt;li&gt;What is 3 Musketeers?&lt;/li&gt;
&lt;li&gt;What is AWS CDK&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are a host of benefits to the 3 Musketeers pattern, which mostly center around Developer Experience. 3 Musketeers packages all the dependencies up into one container, making it easy for the whole team to stay up-to-date. The other substantial benefit I see of the 3 Musketeers pattern is just how darn easy it makes it to set up new developers. Simply make sure they install docker, docker-compose, and make (also WSL on Windows). Now setup for new projects is as simple as cloning down the repo and running make install.&lt;/p&gt;

&lt;p&gt;If you’ve worked on any number of CDK projects, you’ve probably run into hiccups with dependency management, and you know how difficult these issues can be to fight through, especially for developers new to Node. It should be obvious now how 3 Musketeers can mitigate these.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;p&gt;Now that we’ve seen why it’s a good idea to use the 3 Musketeers pattern with the AWS CDK, let’s jump right into it.&lt;/p&gt;

&lt;p&gt;Start by cloning down this repo from GitHub: &lt;a href="https://github.com/chrishart0/aws-cdk-typescript-3-musketeers"&gt;https://github.com/chrishart0/aws-cdk-typescript-3-musketeers&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This will have everything you need to try out containerized AWS CDK. Let’s go through the contents of this repo first.&lt;/p&gt;

&lt;p&gt;Notice that the &lt;a href="https://github.com/chrishart0/aws-cdk-typescript-3-musketeers/tree/master/infrastructure"&gt;&lt;em&gt;infrastructure&lt;/em&gt;&lt;/a&gt; directory is the output of running the command cdk init sample-app — language typescript. This gives us a basic sample app to work with. If you aren’t familiar with the AWS CDK in typescript, the &lt;em&gt;&lt;a href="https://github.com/chrishart0/aws-cdk-typescript-3-musketeers/blob/master/infrastructure/lib/infrastructure-stack.ts"&gt;infrastructure/lib/infrastructure-stack.ts&lt;/a&gt;&lt;/em&gt; file is where the infrastructure to be deployed is located. You will notice an SQS queue and an SNS topic have been defined with the queue subscribed to the SNS topic.&lt;/p&gt;

&lt;p&gt;You can use this repo as is or replace the contents of &lt;em&gt;&lt;a href="https://github.com/chrishart0/aws-cdk-typescript-3-musketeers/tree/master/infrastructure"&gt;infrastructure&lt;/a&gt;&lt;/em&gt; with your work.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use this Repo as a Starting Point
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Note: You don’t need an AWS account setup to test this locally, simply skip running the bootstrap command&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Open up the CLI into the root of the repo you’ve cloned down locally.&lt;/p&gt;

&lt;p&gt;Run the command make; this will do all the needed setup and run cdk synth from within the docker container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ make
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have never used AWS CDK in your configured AWS account before then you must run the CDK bootstrapper. If you simply want to test this repo out locally you can skip this step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ make bootstrap
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are now free to run any other commands available such as &lt;code&gt;cdk diff&lt;/code&gt;, &lt;code&gt;cdk deploy&lt;/code&gt;, and &lt;code&gt;cdk destroy&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://miro.medium.com/max/700/1*XeZSVbCmVtuq-PbS8Juf2A.gif"&gt;Gif of make deploy running&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use this in an existing project
&lt;/h2&gt;

&lt;p&gt;If you have an existing project and would like to use this 3 Musketeers pattern then follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the &lt;code&gt;Makefile&lt;/code&gt;, &lt;code&gt;Dockerfile&lt;/code&gt;, and &lt;code&gt;docker-compose.yaml&lt;/code&gt; files into the root of your project&lt;/li&gt;
&lt;li&gt;Update the &lt;code&gt;CDK_PATH&lt;/code&gt; variable in &lt;code&gt;three_musketeers.env&lt;/code&gt; and &lt;code&gt;Makefile&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Run make to do initial setup and output cdk synth to verify everything is configured right
For more information refer to the &lt;a href="https://github.com/chrishart0/aws-cdk-typescript-3-musketeers"&gt;README&lt;/a&gt; on the GitHub repo. I’d love to hear any thoughts, comments, or critiques in the comments below.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>cdk</category>
      <category>aws</category>
      <category>iac</category>
      <category>3musketeers</category>
    </item>
    <item>
      <title>How to Use Tesseract OCR to Convert PDFs to Text</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Mon, 21 Feb 2022 00:36:40 +0000</pubDate>
      <link>https://dev.to/chrishart0/how-to-use-tesseract-ocr-to-convert-pdfs-to-text-564f</link>
      <guid>https://dev.to/chrishart0/how-to-use-tesseract-ocr-to-convert-pdfs-to-text-564f</guid>
      <description>&lt;p&gt;This is a cross-post from my blog &lt;a href="https://arcadian.cloud/linux/2022/02/20/how-to-use-tesseract-ocr-to-convert-pdfs/" rel="noopener noreferrer"&gt;Arcadian.Cloud&lt;/a&gt;, go there to see the original post. &lt;/p&gt;

&lt;p&gt;I have some PDFs which I need to get typed up into text to edit. I decided to go with Tesseract OCR as it seems to be the best tool for the job. Here are the steps for how to use Tesseract OCR to convert PDFs to text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;First things first, get Tesseract CLI installed. Follow the instructions here, these are linked to from the official Tesseract docs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo add-apt-repository ppa:alex-p/tesseract-ocr-devel
sudo apt-get update
sudo apt install tesseract-ocr tesseract-ocr-eng
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Note: the package didn’t properly place the eng.traineddata file for me. If you get an error about this refer to the troubleshooting steps at the bottom of this article.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;In the CLI, cd into the directory with the images or PDFs you want to convert.&lt;/p&gt;

&lt;p&gt;Remember, Tesseract cannot convert PDFs, so first we must convert the PDF to a .tiff file, then we can convert the .tiff to text.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#Convert the PDF to a .tiff file, change out the file names at the end of this command to your own
#Note: If you get an error about security policy check the troubleshooting section below
convert -fill white -draw 'rectangle 10,10 20,20' -background white +matte -density 300 Loring-Lombard-Autobiogrphy-Pages1-10.pdf Loring-Lombard-Autobiogrphy-Pages1-10.tiff

#Tesseract will add .txt to the end of the new file name
tesseract Loring-Lombard-Autobiogrphy-Pages1-10.tiff Loring-Lombard-Autobiogrphy-Pages1-10
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fxs5qtci8mr0dw2d9o8xz.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%2Fxs5qtci8mr0dw2d9o8xz.png" alt="Convert PDF to .tiff file"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was able to safely ignore these errors. Once the PDF to .tiff conversion finished I ran the tesseract command to created the text file.&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%2Fauspqkp1alnin2t2fnhl.gif" 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%2Fauspqkp1alnin2t2fnhl.gif" alt="Tesseract OCR Conversion to text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should now have a text file created. It really is as easy as that to Use Tesseract OCR to Convert PDFs to text files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Troubleshooting
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Missing Language Training Data
&lt;/h3&gt;

&lt;p&gt;If you see something like the bellow error message it means you missed installing the English training data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error opening data file /usr/share/tesseract-ocr/5/tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simply install the tesseract-ocr-eng package with the below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install tesseract-ocr-eng
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If this doesn’t fix it then check out &lt;a href="https://github.com/tesseract-ocr/tesseract/issues/221" rel="noopener noreferrer"&gt;this GitHub issue&lt;/a&gt; for more troubleshooting steps.&lt;/p&gt;

&lt;h3&gt;
  
  
  Convert Tool Security Policy Error
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;convert-im6.q16: attempt to perform an operation not allowed by the security policy `PDF' @ error/constitute.c/IsCoderAuthorized/421.
convert-im6.q16: no images defined `converted-pdf.tiff' @ error/convert.c/ConvertImageCommand/3229.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To fix the above error you need to edit or get rid of the imagemagic security policy. The simplest solution is to temporarily rename the security policy but this may be dangerous if you forget to put it back. Instead, I recommend just edit the policy and remove the offending policy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Checkout &lt;a href="https://stackoverflow.com/questions/52861946/imagemagick-not-authorized-to-convert-pdf-to-an-image" rel="noopener noreferrer"&gt;this StackOverflow post&lt;/a&gt; for more details on working around this error.&lt;/p&gt;

</description>
      <category>tesseract</category>
      <category>ocr</category>
      <category>pdf</category>
      <category>convert</category>
    </item>
    <item>
      <title>Enable Lambda Insights Using Python AWS CDK</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Tue, 23 Nov 2021 03:17:17 +0000</pubDate>
      <link>https://dev.to/signet-seal/enable-lambda-insights-using-python-aws-cdk-23g3</link>
      <guid>https://dev.to/signet-seal/enable-lambda-insights-using-python-aws-cdk-23g3</guid>
      <description>&lt;h2&gt;
  
  
  Code for enabling Lambda Insights with the Python CDK
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Define the layer, make sure you use the right layer for your region and the pick the most up to date layer https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versions.html

layerArn='arn:aws:lambda:us-east-1:580247275435:layer:LambdaInsightsExtension:14'
insight_layer = _lambda.LayerVersion.from_layer_version_arn(self,'lambda_insights_layer',layerArn)

#Add the layer to the function as shown below
_lambda.Function(
    self, 'my_function',
    runtime=_lambda.Runtime.PYTHON_3_8,
    handler='my_function.handler',
    code=_lambda.Code.from_asset(
        path = 'lambda'
    ),
    layers=[insight_layer]
)

# Optional: Add the managed policy 
If using the `AWSLambdaBasicExecutionRole`, which CDK uses by default when creating a Lambda function, there is no need to do this. Otherwise, add the `CloudWatchLambdaInsightsExecutionRolePolicy` managed policy to the function.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; make sure to pick the most up to date and correct region ARN for the Lambda Insights Extension layer. Reference &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-extension-versions.html"&gt;these docs here&lt;/a&gt; for ARNs for all regions and version&lt;/p&gt;

&lt;p&gt;Here are the &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights-Getting-Started-clouddevelopmentkit.html"&gt;AWS docs&lt;/a&gt; on how to enable Lambda Insights for the Typescript CDK.&lt;/p&gt;

&lt;h2&gt;
  
  
  More CDK or AWS Serverless Questions?
&lt;/h2&gt;

&lt;p&gt;Feel free to leave a comment here or hit us up on &lt;a href="https://www.linkedin.com/company/signet-seal"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to learn more about how SignetSeal can help make your chats more secure? Read more about us on our website &lt;a href="https://signetseal.com/"&gt;SignetSeal.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>lambda</category>
      <category>monitoring</category>
      <category>devops</category>
    </item>
    <item>
      <title>Configure CORS for an S3 Bucket Using Python AWS CDK</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Tue, 23 Nov 2021 02:41:54 +0000</pubDate>
      <link>https://dev.to/signet-seal/configure-cors-for-an-s3-bucket-using-python-aws-cdk-4kn2</link>
      <guid>https://dev.to/signet-seal/configure-cors-for-an-s3-bucket-using-python-aws-cdk-4kn2</guid>
      <description>&lt;h2&gt;
  
  
  Get right to it, here is the code
&lt;/h2&gt;

&lt;p&gt;Python CDK code for configuring CORS on an S3 bucket.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bucket = s3.Bucket(self, "myBucket",
    cors=[
        s3.CorsRule(
            allowed_headers=[CORS_headers],
            allowed_methods=[s3.HttpMethods.PUT, s3.HttpMethods.POST, s3.HttpMethods.GET, s3.HttpMethods.DELETE],
            allowed_origins=[CORS_url]
        )
    ]
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A list of the HTTP methods which can be configured can be found here in the &lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/HttpMethods.html#aws_cdk.aws_s3.HttpMethods"&gt;aws_cdk.aws_s3.HttpMethods docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Relevant docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/Bucket.html"&gt;https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/Bucket.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html"&gt;https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More CDK or AWS Serverless Questions?
&lt;/h2&gt;

&lt;p&gt;Feel free to leave a comment here or hit us up on &lt;a href="https://www.linkedin.com/company/signet-seal"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to learn more about how SignetSeal can help make your chats more secure? Read more about us on our website &lt;a href="https://signetseal.com/"&gt;SignetSeal.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudnative</category>
      <category>cdk</category>
      <category>s3</category>
    </item>
    <item>
      <title>Create S3 Lifecycle Rules with Tag Filters Using Python AWS CDK</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Thu, 21 Oct 2021 23:55:21 +0000</pubDate>
      <link>https://dev.to/signet-seal/create-s3-lifecycle-rules-with-tag-filters-using-python-aws-cdk-4d2o</link>
      <guid>https://dev.to/signet-seal/create-s3-lifecycle-rules-with-tag-filters-using-python-aws-cdk-4d2o</guid>
      <description>&lt;h2&gt;
  
  
  Get right to it, here is the code
&lt;/h2&gt;

&lt;p&gt;Python CDK code for creating an S3 bucket with a lifecycle rule which uses a tag filter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bucket = s3.Bucket(self, "myBucket",
    lifecycle_rules = [
        s3.LifecycleRule(
            id="example-rule-made-with-python-cdk",
            expiration=core.Duration.days(1),
            tag_filters={ 
                'Key': 'delete_in_1_day', 
                'Value': 'true'
            }
        )
    ]
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Relevant CDK docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/Bucket.html"&gt;https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/Bucket.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/LifecycleRule.html#aws_cdk.aws_s3.LifecycleRule"&gt;https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_s3/LifecycleRule.html#aws_cdk.aws_s3.LifecycleRule&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; AWS Lifecycle rules do not get more precise than 24 hours[&lt;a href="https://aws.amazon.com/premiumsupport/knowledge-center/s3-lifecycle-rule-delay/"&gt;docs&lt;/a&gt;]. &lt;/p&gt;

&lt;h2&gt;
  
  
  More CDK or AWS Serverless Questions?
&lt;/h2&gt;

&lt;p&gt;Feel free to leave a comment here or hit us up on &lt;a href="https://www.linkedin.com/company/signet-seal"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to learn more about how SignetSeal can help make your chats more secure? Read more about us on our website &lt;a href="https://signetseal.com/"&gt;SignetSeal.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudnative</category>
      <category>cdk</category>
      <category>s3</category>
    </item>
    <item>
      <title>Create CloudWatch Alarms with Python AWS CDK </title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Thu, 21 Oct 2021 23:24:14 +0000</pubDate>
      <link>https://dev.to/signet-seal/create-cloudwatch-alarms-with-python-aws-cdk-1e53</link>
      <guid>https://dev.to/signet-seal/create-cloudwatch-alarms-with-python-aws-cdk-1e53</guid>
      <description>&lt;h2&gt;
  
  
  Create the alarm
&lt;/h2&gt;

&lt;p&gt;Put this into your Python AWS CDK stack to create an alarm on a bucket asigned to a varibale named &lt;code&gt;bucket&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;bucket = s3.Bucket...

s3_size_alarm = cloudwatch.Alarm(self, 'bucket_overloaded_alarm',
    metric= cloudwatch.Metric(
        namespace = "AWS/S3", 
        metric_name = "BucketSizeBytes",
        dimensions={
            "BucketName": bucket.bucket_name,
            "StorageType": "StandardStorage",
        },
        period = core.Duration.days(1),
        statistic="Maximum",
    ), 
    evaluation_periods=1, 
    threshold=1000000000 #1 GB
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will create a CloudWatch alarm which:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Alarm if the size of the bucket goes over 1GB&lt;/li&gt;
&lt;li&gt;Only monitors objects with the &lt;code&gt;StandardStorage&lt;/code&gt; type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Relevant CDK docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_cloudwatch/Alarm.html"&gt;https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_cloudwatch/Alarm.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_cloudwatch/Metric.html"&gt;https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_cloudwatch/Metric.html&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Warning:&lt;/strong&gt; Don't rely on an alarm watching the &lt;code&gt;BucketSizeBytes&lt;/code&gt; metric to make sure your bucket doesn't grow too large. This metric is &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/cloudwatch-monitoring.html"&gt;only collected once a day&lt;/a&gt;. Consider opting in to &lt;a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/metrics-dimensions.html"&gt;S3 request metrics&lt;/a&gt; for more in-depth S3 monitoring&lt;/p&gt;

&lt;h2&gt;
  
  
  Create alarm action
&lt;/h2&gt;

&lt;p&gt;Alarms aren't very useful if they don't do anything. Setup some actions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;topic = sns.Topic.from_topic_arn(self,'snstopic',"arn:aws:sns:us-east-1:123456789012:alarm-go-ahhhhhhhhhhhh")

s3_size_alarm.add_alarm_action(
    cloudwatch_actions.SnsAction(
        topic = topic
    )
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Relevant CDK docs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_sns/Topic.html#aws_cdk.aws_sns.Topic.from_topic_arn"&gt;https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_sns/Topic.html#aws_cdk.aws_sns.Topic.from_topic_arn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More CDK or AWS Serverless Questions?
&lt;/h2&gt;

&lt;p&gt;Feel free to leave a comment here or hit us up on &lt;a href="https://www.linkedin.com/company/signet-seal"&gt;LinkedIn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Want to learn more about how SignetSeal can help make your chats more secure? Read more about us on our &lt;a href="https://signetseal.com/"&gt;website&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cdk</category>
      <category>iac</category>
      <category>cloudnative</category>
    </item>
    <item>
      <title>You Are Using Story Points Wrong: How to Make Story Points Suck Less</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Thu, 21 Oct 2021 17:41:55 +0000</pubDate>
      <link>https://dev.to/chrishart0/you-are-using-story-points-wrong-how-to-make-story-points-suck-less-269f</link>
      <guid>https://dev.to/chrishart0/you-are-using-story-points-wrong-how-to-make-story-points-suck-less-269f</guid>
      <description>&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%2Fwotel6xfxfmjwdodwyii.jpeg" 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%2Fwotel6xfxfmjwdodwyii.jpeg" alt="Big Brain"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Realistic representation of how you will actually look when you finish reading this article and show off your story pointing knowledge to your friends, family, and co-workers.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Preamble
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://medium.com/contino-engineering/you-are-using-story-points-wrong-how-to-make-story-points-suck-less-c641c34ce63" rel="noopener noreferrer"&gt;Cross-Post from Medium Post&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Amongst people in the software industry there is a lot of confusion around story points. This blog is my summary of great minds opinions on the topic of story points with some of my own opinions throw in as well.&lt;/p&gt;

&lt;p&gt;Story points are part of scrum, right? No. Go read the scrum guide(&lt;a href="https://scrumguides.org/scrum-guide.html" rel="noopener noreferrer"&gt;link&lt;/a&gt;) yourself, there is no mention of story points or even user stories. Don't adopt story points as a default, adopt them because they are solving a problem. &lt;/p&gt;

&lt;p&gt;The goal of this article is not to give the reader a set of hard rules. Instead, the reader should work to understand this as a starting point and then evolve into what best suits the team.&lt;/p&gt;

&lt;p&gt;Got a question or disagree with something? Leave it in the comments. &lt;/p&gt;

&lt;h2&gt;
  
  
  What are Story Points?
&lt;/h2&gt;

&lt;p&gt;Story points are an &lt;em&gt;arbitrary&lt;/em&gt;, &lt;em&gt;imprecise&lt;/em&gt;, and &lt;em&gt;relative&lt;/em&gt; estimate of &lt;em&gt;effort&lt;/em&gt;, &lt;em&gt;complexity&lt;/em&gt;, and &lt;em&gt;uncertainty&lt;/em&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Relative
&lt;/h3&gt;

&lt;p&gt;Story points are relative to previously sized stories. &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%2F7ickrb9ilgl19lieyrya.jpeg" 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%2F7ickrb9ilgl19lieyrya.jpeg" alt="Big Brain Relative vs Small Brain Time"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Arbitrary
&lt;/h3&gt;

&lt;p&gt;A team invents their own pointing system. The first story sized is given an arbitrary point value as decided by the team, from then on stories are sized in relation to that story. &lt;/p&gt;

&lt;p&gt;This means that the first sets of stories won't be as useful as they have nothing to be relative to and many assumptions have to be made. The first stories are intended to be the first step in making future relative decisions, so this is okay.&lt;/p&gt;

&lt;h3&gt;
  
  
  Size Parameters
&lt;/h3&gt;

&lt;p&gt;What goes into a size?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Complexity&lt;/li&gt;
&lt;li&gt;Uncertainty&lt;/li&gt;
&lt;li&gt;Effort&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Learn from the past to improve future estimates!&lt;/p&gt;

&lt;h3&gt;
  
  
  Story Points are Not
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Estimate of time

&lt;ul&gt;
&lt;li&gt;Very difficult to estimate time, hard to get right&lt;/li&gt;
&lt;li&gt;Story points trade off precision to make estimating easier &lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Exact end dates&lt;/li&gt;

&lt;li&gt;Exact time spent&lt;/li&gt;

&lt;li&gt;Time tracking&lt;/li&gt;

&lt;li&gt;For comparing team's output

&lt;ul&gt;
&lt;li&gt;Story points are, by definition, relative and unique to each team 

&lt;ul&gt;
&lt;li&gt;Thus, comparing one team's velocity to another team's velocity is pointless(&lt;em&gt;pun intended&lt;/em&gt;)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Once points leave a team they are useless&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Story Points?
&lt;/h2&gt;

&lt;p&gt;Story points are an imprecise forecast of a team's capacity/velocity, helping to develop shared understanding, and useful in negotiating task priority.&lt;/p&gt;

&lt;p&gt;Before deciding to use story points it is crucial to have a good understanding of why you want to use them. What benefits will the team get from story points? What are the downsides? &lt;/p&gt;

&lt;p&gt;Nowadays(2021), many experts recommend not using story points at all. Mostly, this sentiment comes from companies being tempted to weaponize story points against their developers. &lt;a href="https://rigidity.medium.com/agile-waste-story-points-pt-1-a9df2572d0a3" rel="noopener noreferrer"&gt;Read more about the no story points debate here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why should we use story points? Why not just estimate time?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cost of estimation is low

&lt;ul&gt;
&lt;li&gt;Imprecise, allows us to more quickly make estimations&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;High accuracy and low precision

&lt;ul&gt;
&lt;li&gt;Relative sizing requires less effort to be accurate than time based estimations

&lt;ul&gt;
&lt;li&gt;Asking how complex / effortful is this thing compared to that thing is much easier than estimating how long it will take&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Imprecision of story points allows for quick estimation&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h3&gt;
  
  
  Purposes
&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;Please note that this is a contentious topic, there is debate on what all uses story points should be put.&lt;/em&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Negotiating Priority
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;"If you want A by the end of the month then we are going to have to push B until next month."&lt;/li&gt;
&lt;li&gt;Stops the team from committing to doing to much in a period(iteration)

&lt;ul&gt;
&lt;li&gt;A metric to be used to push back against excessive work and prevent burn-out&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Helps the team to say no&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;"Provides healthy boundaries for the team"&lt;/li&gt;
&lt;li&gt;Be careful not to show the numbers, they are for the product team's use only

&lt;ul&gt;
&lt;li&gt;Don't allow story points to be turned into a currency&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;Useful for using stories on a &lt;a href="https://www.atlassian.com/team-playbook/plays/prioritization-matrix" rel="noopener noreferrer"&gt;prioritization matrix&lt;/a&gt;
&lt;/li&gt;

&lt;/ul&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%2Fxwcwuvrzgmjs8g5d3e3d.gif" 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%2Fxwcwuvrzgmjs8g5d3e3d.gif" alt="Dilbert priorities comic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Shared Understanding
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;If a story is sized, it shows the team has developed a shared understanding of what it will take to complete it&lt;/li&gt;
&lt;li&gt;Story points are a prompter for conversation to get the whole to understand what will go into completing the task&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"What are you thinking so I can think like that?"&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Get in the same head space about everything which will go into a story

&lt;ul&gt;
&lt;li&gt;Example: 

&lt;ul&gt;
&lt;li&gt;John: "This is about a 1, we just need to make a quick update to the Shaw-Fujikawa Translight function."&lt;/li&gt;
&lt;li&gt;Jill: "You're forgetting we have not implemented automated testing for rupture generation, this will be a 3."&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Slicing Signal
&lt;/h4&gt;

&lt;p&gt;A signal that a task has not been broken down enough&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"That is a lot of points, has this been broken down enough?"&lt;/li&gt;
&lt;li&gt;"Can this fit into the iteration?"&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to use Story Points
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Make sure to remember the first few iterations the estimates will be highly inaccurate, over time this will improve&lt;/li&gt;
&lt;li&gt;Map story points to approximate effort/complexity/uncertainty&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Story Pointing Frameworks
&lt;/h3&gt;

&lt;p&gt;There are a number of frameworks for story points. &lt;/p&gt;

&lt;p&gt;Here are a few, listed below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;T-shirt sizes (S, M, L, XL) (easy to start with)&lt;/li&gt;
&lt;li&gt;Integers: tools like Jira can provide burndown charts, scope creep indicators and other metrics when using integers

&lt;ul&gt;
&lt;li&gt;Standard: (1, 2, 3, 4, 5, ect)&lt;/li&gt;
&lt;li&gt;Fibonacci-style scale (0, 1, 2, 3, 5, 8)

&lt;ul&gt;
&lt;li&gt;Fibonacci-style scale without 2 (0, 1, 3, 5, 8)

&lt;ul&gt;
&lt;li&gt;"Less is more"&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Why use Fibonacci? &lt;a href="https://www.mountaingoatsoftware.com/blog/why-the-fibonacci-sequence-works-well-for-estimating" rel="noopener noreferrer"&gt;Here is a good article&lt;/a&gt;
&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;Time based (antiquated, not recommended)

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Caution:&lt;/strong&gt; these are not recommended for reasons documented elsewhere in this article

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.scruminc.com/story-points-why-are-they-better-than/" rel="noopener noreferrer"&gt;Read more here on why story points are better than time&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Time&lt;/li&gt;

&lt;li&gt;&lt;a href="http://www.extremeprogramming.org/rules/iterationplanning.html" rel="noopener noreferrer"&gt;Ideal Time&lt;/a&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h4&gt;
  
  
  Tips for Choosing a Framework
&lt;/h4&gt;

&lt;p&gt;Items to consider when the team is deciding on their story pointing framework&lt;/p&gt;

&lt;h4&gt;
  
  
  Less is more
&lt;/h4&gt;

&lt;p&gt;You don't want to allow for too many options, this will lead to analysis paralysis. Remember, story points are meant to be imprecise, we don't want to spend too much time trying to pick the perfect number. &lt;/p&gt;

&lt;p&gt;We are trading off precision for ease of use on purpose. &lt;/p&gt;

&lt;h4&gt;
  
  
  Upper Limit
&lt;/h4&gt;

&lt;p&gt;Decide on an upper limit of effort/complexity (e.g. your team may decide that for them a 13 is "too large for one feature/story")&lt;/p&gt;

&lt;p&gt;If a story breaks the upper limit then it needs to be broken down into smaller pieces. &lt;/p&gt;

&lt;h4&gt;
  
  
  Have it your way
&lt;/h4&gt;

&lt;p&gt;Teams should pick their own standard, it shouldn't be imposed by anyone else. Remember, story points are to be used by the team for themselves. &lt;/p&gt;

&lt;h3&gt;
  
  
  Planning for new teams
&lt;/h3&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%2F6kecfosbqyrbqjo31p7o.jpeg" 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%2F6kecfosbqyrbqjo31p7o.jpeg" alt="Dilbert estimation comic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a new team comes together their estimates will be difficult to agree on and very uncertain, that's okay, they don't have a point of reference yet.&lt;/p&gt;

&lt;p&gt;Find 1-2 well defined/known stories and understand "what a 1 vs 3 vs 5 looks like". Once the team has these stories, they can start to use &lt;em&gt;relative estimation&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Golden Story
&lt;/h4&gt;

&lt;p&gt;Some teams use what is called a &lt;em&gt;golden story&lt;/em&gt;. This is the first story estimated for a product. It is then used as a point of reference throughout the lifecycle of the product. &lt;/p&gt;

&lt;p&gt;For another take on golden stories checkout &lt;a href="https://medium.com/r/?url=https%3A%2F%2Fblizzardcomputing.com%2Fwp%2Fblog%2Findex.php%2F2016%2F06%2F27%2Fwhy-estimating-stories-in-agile-is-painful-part-1%2F" rel="noopener noreferrer"&gt;this article on the Blizzard Computing blog&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Example of a team developing a pointing standard:
&lt;/h4&gt;

&lt;p&gt;The team decides on 1-8 of the fibonacci sequence, so 3 is a medium 1 is extra small, and 8 is extra large. &lt;/p&gt;

&lt;h5&gt;
  
  
  Example Estimation
&lt;/h5&gt;

&lt;ul&gt;
&lt;li&gt;Login is a story of about medium size, the team guess, so they decide to size it as a 3&lt;/li&gt;
&lt;li&gt;Next sprint, the team sizes logout

&lt;ul&gt;
&lt;li&gt;3 parameters

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complexity:&lt;/strong&gt; Logout is a lot simpler than login&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Effort:&lt;/strong&gt; There will be a lot less work to do than with login&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncertainty:&lt;/strong&gt; Since the team just worked on login, the uncertainty is low, they are familiar with the code around this functionality and have a good idea of what needs to be done&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;Assessing logout in relation to Login, the complexity is lower, there is less effort needed, and the uncertainty is low&lt;/li&gt;

&lt;li&gt;The team decides to size logout as a 1&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;The following sprint, the team needs to estimate a story for allowing the user to update their email

&lt;ul&gt;
&lt;li&gt;3 parameters

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complexity:&lt;/strong&gt; Updating email touches a lot of pieces, the UI, the API, the DB, as well as having the user verify the new email

&lt;ul&gt;
&lt;li&gt;Certainly less complex than login but probably a bit more complex than logout&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Effort:&lt;/strong&gt; The complexity suggests the effort will be between logout and login&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Uncertainty:&lt;/strong&gt; There isn't too much uncertainty here, the team has sent emails from the application before and nothing else is too experimental&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;The team decides this is larger than logout but smaller than login, so they estimate it at a 2. &lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;li&gt;Next up, the business has asked us to port over 102 static pages from an old application 

&lt;ul&gt;
&lt;li&gt;3 parameters

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complexity:&lt;/strong&gt; Complexity is very low, these are just simple html and css pages which need to be copied over, maybe a few small css changes here and there just make them fit in&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Effort:&lt;/strong&gt; Effort is high, there are 102 pages to port over, largely this is an effort in using copy and paste&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Uncertainty:&lt;/strong&gt; The uncertainty is low, just some basic pages added to the UI&lt;/li&gt;
&lt;li&gt;While the complexity and uncertainty are low, the team decides, in relation to the other stories, this should be sized the same as login due to the large amount of effort it will take to move over all the pages over&lt;/li&gt;
&lt;li&gt;The story gets a 3&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;h5&gt;
  
  
  Example Takeaways
&lt;/h5&gt;

&lt;p&gt;Notice how in the example we did not discuss time, but always talked about effort, complexity, and uncertainty. This is how story points should be thought of. &lt;/p&gt;

&lt;p&gt;These sizes are not meant to be precise, they are meant to be quick and easy. &lt;/p&gt;

&lt;h2&gt;
  
  
  What to watch out for
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Talking about days
&lt;/h3&gt;

&lt;p&gt;Remember to use relative effort/complexity/uncertainty, not time.&lt;/p&gt;

&lt;h3&gt;
  
  
  Spending too much time discussing process intricacies
&lt;/h3&gt;

&lt;p&gt;Don't get stuck in the weeds. &lt;/p&gt;

&lt;p&gt;Don't get stuck in the weeds. If there are some "3s" and a "5" then don't spend a lot of time discussing if you should introduce a "4"&lt;/p&gt;

&lt;h3&gt;
  
  
  Management manipulating with the team's points
&lt;/h3&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%2Fygzl6etb0dsyfdem578a.jpeg" 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%2Fygzl6etb0dsyfdem578a.jpeg" alt="Dilbert manipulating estimates comic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What happens when the team doesn't agree?
&lt;/h2&gt;

&lt;p&gt;The team votes at the same time to avoid influencing each other, in human psychology that's called anchoring.&lt;/p&gt;

&lt;p&gt;The team then discuss the sizes to achieve consensus.&lt;/p&gt;

&lt;h3&gt;
  
  
  Achieve shared understanding
&lt;/h3&gt;

&lt;p&gt;The team discuses the story with the goal of achieving shared understanding.&lt;/p&gt;

&lt;h4&gt;
  
  
  Figure out why the team does not agree
&lt;/h4&gt;

&lt;p&gt;Is there something part of the team isn't thinking about? Refer back to the example in the Develop Shared Understanding section.&lt;/p&gt;

&lt;p&gt;Maybe less experienced devs are estimating higher due to more uncertainty on their part. In this case, pick a team norm for how to handle this and move on quickly. Some possible norms would be taking the average if there is a wide range or taking the larger size if the sizes are close. &lt;/p&gt;

&lt;p&gt;The pattern to avoid is spending many minutes during a team-wide meeting debating back and forth. If the story needs more more work, drop it and save it for later, don't waste the whole teams time.&lt;/p&gt;

&lt;h2&gt;
  
  
  History
&lt;/h2&gt;

&lt;p&gt;The term 'Story points' originated in the late 1990s from the XP concept of "ideal time". Ron Jeffries may have been the originator of this term.&lt;/p&gt;

&lt;p&gt;Read more about story point history here: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://ronjeffries.com/articles/019-01ff/story-points/Index.html" rel="noopener noreferrer"&gt;https://ronjeffries.com/articles/019-01ff/story-points/Index.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Origins section: &lt;a href="https://www.agilealliance.org/glossary/points-estimates-in/" rel="noopener noreferrer"&gt;https://www.agilealliance.org/glossary/points-estimates-in/&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How to work within an imposed framework will vary from team to team.&lt;/p&gt;

&lt;h2&gt;
  
  
  More Resources:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Blogs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://martinfowler.com/bliki/StoryPoint.html" rel="noopener noreferrer"&gt;Story Points by Martin Fowler&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.scrum.org/resources/blog/myth-14-refinement-required-meeting-entire-scrum-team" rel="noopener noreferrer"&gt;Myth 14: Refinement is a required meeting for the entire Scrum Team&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blizzardcomputing.com/wp/blog/index.php/2016/06/27/why-estimating-stories-in-agile-is-painful-part-1/" rel="noopener noreferrer"&gt;Why Estimating Stories In Agile Is Painful, Part 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.atlassian.com/team-playbook/plays/prioritization-matrix" rel="noopener noreferrer"&gt;Allthethings Prioritization Matrix&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://ronjeffries.com/articles/019-01ff/story-points/Index.html" rel="noopener noreferrer"&gt;Story Points Revisited&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Videos
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.youtube.com/watch?v=VsSaolMtkKU&amp;amp;vl=en" rel="noopener noreferrer"&gt;What are Story Points? by Mountain Goat Software(Mike Cohn)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Books
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.oreilly.com/library/view/clean-agile-back/9780135782002/" rel="noopener noreferrer"&gt;Clean Agile by Robert C. Martin&lt;/a&gt; - p64-p81&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>agile</category>
      <category>storypoints</category>
      <category>userstory</category>
      <category>scrum</category>
    </item>
    <item>
      <title>Increase AWS CDK Lambda development speed by testing locally with AWS SAM</title>
      <dc:creator>chrishart0</dc:creator>
      <pubDate>Mon, 20 Sep 2021 14:45:31 +0000</pubDate>
      <link>https://dev.to/chrishart0/increase-aws-cdk-lambda-development-speed-by-testing-locally-with-aws-sam-28ma</link>
      <guid>https://dev.to/chrishart0/increase-aws-cdk-lambda-development-speed-by-testing-locally-with-aws-sam-28ma</guid>
      <description>&lt;p&gt;This is a cross-post from &lt;a href="https://medium.com/contino-engineering/increase-your-aws-cdk-lambda-development-speed-by-testing-locally-with-aws-sam-48a70987515c" rel="noopener noreferrer"&gt;https://medium.com/contino-engineering/increase-your-aws-cdk-lambda-development-speed-by-testing-locally-with-aws-sam-48a70987515c&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Git repo with all code completed:&lt;a href="https://github.com/chrishart0/aws-cdk-sam-demo" rel="noopener noreferrer"&gt;https://github.com/chrishart0/aws-cdk-sam-demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This article explains how to locally test, with &lt;a href="https://aws.amazon.com/serverless/sam/" rel="noopener noreferrer"&gt;AWS SAM&lt;/a&gt;(Serverless Application Model), a Lambda function + API Gateway created with &lt;a href="https://aws.amazon.com/cdk/" rel="noopener noreferrer"&gt;AWS CDK&lt;/a&gt;(Cloud Development Kit).&lt;/p&gt;

&lt;p&gt;When using AWS CDK for your infrastructure as code, it can be a pain to figure out how to efficiently test your Lambda functions. Deploying your code to AWS with cdk deploy for every change is slow, having to run a deploy for every code change is not ideal. Luckily it is straightforward to use AWS SAM to test your function locally. &lt;/p&gt;

&lt;p&gt;For scenarios where local dev isn’t feasible, get faster deployments to Lambda with &lt;a href="https://github.com/aws/aws-cdk/blob/master/packages/aws-cdk/README.md#hotswap-deployments-for-faster-development" rel="noopener noreferrer"&gt;&lt;code&gt;cdk deploy --hotswap&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/chrishart0/aws-cdk-sam-demo/blob/master/static_content/sam-cdk-demo.gif" rel="noopener noreferrer"&gt;This gif demonstrates using SAM to test Lambda + API Gateway generated with CDK.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Steps 0-2 help you set up a fresh CDK project. &lt;strong&gt;If you already have a CDK project which creates a lambda function and API Gateway, skip ahead to step 3.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  0) Prerequisites, Assumptions, and Environment
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;NPM Installed&lt;/li&gt;
&lt;li&gt;Python Installed&lt;/li&gt;
&lt;li&gt;If you don’t have AWS CDK installed follow this guide: &lt;a href="https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;If you don’t have AWS SAM installed, follow this guide: &lt;a href="https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html" rel="noopener noreferrer"&gt;https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install.html&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1) Initialize a CDK project
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; If this is your first time using AWS CDK with Python, I recommend you try out the CDK Workshop from AWS: &lt;a href="https://cdkworkshop.com/30-python/20-create-project/100-cdk-init.html" rel="noopener noreferrer"&gt;https://cdkworkshop.com/30-python/20-create-project/100-cdk-init.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;⚠️ Optionally: you can clone the completed repo here and skip to step 3&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Create a directory for your project and cd into it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir aws-sam-cdk-demo
$ cd aws-sam-cdk-demo
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, initialize your CDK project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cdk init app --language python
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create and source a python virtual environment&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 -m venv .venv
$ source .venv/bin/activate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install CDK requirements&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run CDK synth to ensure everything is setup correctly&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
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a small CloudFormation template get created with only the CDKMetadata resource and some conditions:&lt;br&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%2Fygnmkizg64s4rlrurmd3.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%2Fygnmkizg64s4rlrurmd3.png" alt="cdk synth output screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2) Create a Lambda function
&lt;/h2&gt;

&lt;p&gt;In this example, I’ll be making an API that provides a greeting from a list of greetings I have hardcoded.&lt;/p&gt;

&lt;p&gt;Create a directory for the lambda code and create a file for the code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir lambda
$ touch lambda/greeting_generator.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go ahead and add some code to your function. You can copy the code from my function and tweak it as you see fit:&amp;lt; &lt;a href="https://github.com/chrishart0/aws-cdk-sam-demo/blob/master/lambda/greeting_generator.py%3E" rel="noopener noreferrer"&gt;https://github.com/chrishart0/aws-cdk-sam-demo/blob/master/lambda/greeting_generator.py&amp;gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Install the lambda and API Gateway constructs
&lt;/h3&gt;

&lt;p&gt;Add &lt;code&gt;aws-cdk.aws-lambda&lt;/code&gt; and &lt;code&gt;aws-cdk.aws-apigateway&lt;/code&gt; as lines to &lt;code&gt;requirements.txt&lt;/code&gt;&lt;br&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%2Flzauyjif1rgq73jdcuju.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%2Flzauyjif1rgq73jdcuju.png" alt="requirements.txt image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Run the command to install the the lambda and API Gateway constructs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pip install -r requirements.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Time to add lambda and API Gateway to your stack
&lt;/h3&gt;

&lt;p&gt;Open the stack file.&lt;/p&gt;

&lt;p&gt;If you aren't familiar with CDK then the stack file may be confusing, this is where infrastructure is defined in a CDK project. &lt;a href="https://github.com/chrishart0/aws-cdk-sam-demo/blob/master/aws_sam_cdk_demo/aws_sam_cdk_demo_stack.py" rel="noopener noreferrer"&gt;See here for reference stack file.&lt;/a&gt; The stack file was created by &lt;code&gt;cdk init&lt;/code&gt;, it follows the naming scheme &lt;code&gt;same_as_your_parent_dir/same_as_your_parent_dir_stack.py&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: Parent folder which init was run in is &lt;code&gt;aws-sam-cdk-demo&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;aws_sam_cdk_demo/aws_sam_cdk_demo_stack.py&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Example in GitHub: &lt;a href="https://github.com/chrishart0/aws-cdk-sam-demo/blob/master/aws_sam_cdk_demo/aws_sam_cdk_demo_stack.py" rel="noopener noreferrer"&gt;https://github.com/chrishart0/aws-cdk-sam-demo/blob/master/aws_sam_cdk_demo/aws_sam_cdk_demo_stack.py&lt;/a&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%2Fwg2j60d7wuxpn48ody4p.png" alt="Stack file example location"&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Import lambda at the top of the stack file referenced above.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from aws_cdk import (
    core,
    aws_lambda as _lambda,
    aws_apigateway as apigateway,
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add code to your stack to generate a lambda function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greeting_function = _lambda.Function(
            self, 'greeting_handler',
            runtime=_lambda.Runtime.PYTHON_3_9,
            code=_lambda.Code.asset('lambda'),
            handler='greeting_generator.handler',
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add code for the API Gateway. Ensure the handler is the same as the variable for the lambda function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;greeting_apg = apigateway.LambdaRestApi(
            self, 'greeting_endpoint',
            handler=greeting_function,
            description="Greeting API endpoint",
        )
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The stack should now look like the image below:&lt;br&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%2Fxpcf4qvih5a0h99i7269.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%2Fxpcf4qvih5a0h99i7269.png" alt="Completed stack"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tip: Add links back to the CDK docs in your code; this will save you a lot of time hunting for the right page in the future.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;cdk synth&lt;/code&gt; to ensure everything compiles. You should now see more resources in the CloudFormation output in your terminal.&lt;/p&gt;
&lt;h2&gt;
  
  
  3) Test that lambda function locally with SAM
&lt;/h2&gt;

&lt;p&gt;Here is where things start to get a little… nutty 🐿️ (get it, like the &lt;a href="https://aws.amazon.com/serverless/build-a-web-app/" rel="noopener noreferrer"&gt;SAM squirrel mascot&lt;/a&gt;???)&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you already have a CDK application with a lambda function start here!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Synthesize a template and write it to &lt;code&gt;template.yaml&lt;/code&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 --no-staging &amp;gt; template.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test the API with SAM&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sam local start-api
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your browser or in another terminal hit the endpoint &lt;code&gt;http://127.0.0.1:3000/&lt;/code&gt;&lt;br&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%2For94rpbiqoa73cto14ih.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%2For94rpbiqoa73cto14ih.png" alt="start API"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can change the code of your lambda function on the fly, no need to restart SAM. Edit the source code in the &lt;code&gt;lambda/&lt;/code&gt; dir and call the endpoint again.&lt;br&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%2Ft2skvzt69mqfdoxi76er.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%2Ft2skvzt69mqfdoxi76er.png" alt="changes on the fly"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also test individual invocations with simulated events, this is ideal if you are not using API Gateway.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sam local invoke functionName -e event.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🎉🎉🎉 Congratulations 🎉🎉🎉
&lt;/h2&gt;

&lt;p&gt;You can now use this very simple strategy to test your Lambda + API Gateway in your own CDK project or use this example project as a starting point.&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cdk</category>
      <category>sam</category>
      <category>lambda</category>
    </item>
  </channel>
</rss>
