<?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: Matthew Bidewell</title>
    <description>The latest articles on DEV Community by Matthew Bidewell (@mattbidewell).</description>
    <link>https://dev.to/mattbidewell</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%2F3975%2F982827a4-82e4-42c4-ac3a-3afa6fcdae61.png</url>
      <title>DEV Community: Matthew Bidewell</title>
      <link>https://dev.to/mattbidewell</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mattbidewell"/>
    <language>en</language>
    <item>
      <title>AWS Lambda Function URLs</title>
      <dc:creator>Matthew Bidewell</dc:creator>
      <pubDate>Tue, 19 Apr 2022 15:35:50 +0000</pubDate>
      <link>https://dev.to/mattbidewell/aws-lambda-function-urls-3bob</link>
      <guid>https://dev.to/mattbidewell/aws-lambda-function-urls-3bob</guid>
      <description>&lt;p&gt;AWS announced a new feature to Lambda, Lambda Function URLs. Here's a quick rundown of what they are, how they work and two ways of creating them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are Lambda Function URLs
&lt;/h2&gt;

&lt;p&gt;Previously, if you wanted to expose a Lambda with an HTTP endpoint you would normally use the fully managed API Gateway service, this new feature will instead allow you to have an HTTPS URL that is directly connected to your Lambda function, cutting out the API Gateway middleman.&lt;/p&gt;

&lt;p&gt;One great feature is the pricing. Lambda Function URLs are completely "free". You'll only ever be paying for the invocation and memory time, like a normal Lambda. This is one advantage over API Gateway which costs to integrate.&lt;/p&gt;

&lt;p&gt;However, that doesn't mean they're a direct replacement for API Gateway. Instead, API Gateway provides more advanced features such as the ability of JWT/custom authorizers, request-response validation and transformation, usage plans, direct built-in AWS firewall support and more.&lt;/p&gt;

&lt;h2&gt;
  
  
   How they work
&lt;/h2&gt;

&lt;p&gt;Each URL is unique to a function's alias or the function ARN which would invoke the latest version of the function. This allows you to deploy multiple versions of a function with different URLs for testing and iterative development.&lt;/p&gt;

&lt;p&gt;Handling the request is straightforward, the event object you normally use in a Lambda is also populated with properties relating to the HTTP request.&lt;br&gt;
For example, you can extract the method from the requestContext.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const method = event.requestContext.http.method;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Any query parameters on the URL can be accessed via a queryStringParameters property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const queryParam = event.querySTringParameters.myParam;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And, finally, you can access the request body from body property.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const body = event.body;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  1. Creating a Lambda URL via ClickOps
&lt;/h3&gt;

&lt;p&gt;You can enable a Function URL from UI when creating a Lambda.&lt;br&gt;
First select advance options and then select Enable function URL .&lt;/p&gt;

&lt;p&gt;This will bring up a new set of options where you can see the authentication settings and configure CORS options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gPKoijkP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6fe89cz2my7spzksvog.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gPKoijkP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v6fe89cz2my7spzksvog.png" alt="The AWS Lambda additional options" width="880" height="171"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What you will see is a new Function URL parameter on the right-hand side of the function options. This is your function URL.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DiCwqzEO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d16ojequbm3uokwtii45.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DiCwqzEO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d16ojequbm3uokwtii45.png" alt="The AWS lambda description panel" width="880" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your code can now be invoked via a web request without the setup of APIGateway!&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Creating a Lambda URL via Cloudformation
&lt;/h3&gt;

&lt;p&gt;Instead of clicks, we can use Cloudformation to create our URL accessible Lambda. Cloudformation is Amazon's Infrastructure as Code and allows you to programmatically create "stacks" and deploy them to AWS.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AWSTemplateFormatVersion: "2010-09-09"
Description: "Cloudformation template for Lambda"
Resources:
  MattsLambda:
    Type: AWS::Lambda::Function
    Properties:
      Description: my lambda with a url
      FunctionName: MattsTestLambda
      Handler: index.handler
      MemorySize: 128
      Runtime: nodejs14.x
      Timeout: 5
      Role: {{ ADD YOUR ROLE ARN HERE }}
      Code:
        S3Bucket: mybucket
        S3Key: mycode.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you've created Lambdas before you'll probably recognise most of the fields above. You'll notice that we didn't add a Lambda Function URL field to the properties. That's because Lambda Function URLs are a new type of Resource rather than a field directly on the Lambda function resource.&lt;/p&gt;

&lt;p&gt;Instead, to create one we need to add an additional resource and reference back to the URL we're creating.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AWSTemplateFormatVersion: "2010-09-09"
Description: "Cloudformation template for Lambda"
Resources:
  MyLambda:
    Type: AWS::Lambda::Function
    Properties:
      Description: my lambda with a url
      FunctionName: MattsTestLambda
      Handler: index.handler
      MemorySize: 128
      Runtime: nodejs14.x
      Timeout: 5
      Role: {{ ADD YOUR ROLE ARN HERE }}
      Code:
        S3Bucket: mybucket
        S3Key: mycode.js
### Lets create the URL ###
  MattsLambdaURL:
    Type: AWS::Lambda::Url
    DependsOn: MyLambda
    Properties:
      AuthType: NONE
      TargetFunctionArn: !GetAtt MyLambda.Arn
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We've added a new resource of type Lambda::Url. But what you should note is we're also adding an DependsOnattribute. This attribute will make sure CloudFormation doesn't deploy the URL resource until our Lambda function has been created. This is because it's dependent on the Lambda ARN, you can see we're referencing it on the final line.&lt;/p&gt;

&lt;p&gt;Running the following command in the terminal will create the stack in Cloudformation which then creates the lambda and the URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;aws cloudformation create-stack --stack-name MyStackName --template-body file://my-file.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, you can upload the stack directly to Cloudformation through the AWS dashboard.&lt;/p&gt;

&lt;p&gt;There you have it, a quick rundown on the latest features of AWS Lambda Function URLs and how to implement them yourselves.&lt;/p&gt;

&lt;h4&gt;
  
  
  Source code:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://github.com/MattBidewell/snippets/tree/main/aws/cloudformation/lambda"&gt;https://github.com/MattBidewell/snippets/tree/main/aws/cloudformation/lambda&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Further reading
&lt;/h4&gt;

&lt;h5&gt;
  
  
  AWS announcement:
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/blogs/aws/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/"&gt;https://aws.amazon.com/blogs/aws/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Cloudformation Lambda Function:
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html"&gt;https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Cloudformation Lambda Url:
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-url.html"&gt;https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-url.html&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Amazon API Gateway
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://aws.amazon.com/api-gateway/"&gt;https://aws.amazon.com/api-gateway/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My Twitter: &lt;br&gt;
&lt;a href="https://twitter.com/MattBidewell"&gt;https://twitter.com/MattBidewell&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://matty.dev"&gt;https://matty.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloudformation</category>
      <category>lambda</category>
    </item>
    <item>
      <title>Remote Engineering culture ideas</title>
      <dc:creator>Matthew Bidewell</dc:creator>
      <pubDate>Wed, 05 Aug 2020 13:42:39 +0000</pubDate>
      <link>https://dev.to/mattbidewell/remote-engineering-culture-ideas-2mha</link>
      <guid>https://dev.to/mattbidewell/remote-engineering-culture-ideas-2mha</guid>
      <description>&lt;p&gt;With COVID-19 in full force, my engineering team has gone full remote.&lt;/p&gt;

&lt;p&gt;In terms of working collaboratively, we're doing really well with a short stand up every morning, pair programming works well with VSCode live share and we have a "enginbeering" mini drink session at the end of the week.&lt;/p&gt;

&lt;p&gt;But we want to make it better. One idea I have is to move some more of the engineering communication from slack to discord as I really like the always-on voice chat channels.&lt;/p&gt;

&lt;p&gt;My question to you all is, if you're now remote or have worked remotely, did you have any unique events or things that promoted a positive "culture" to every from QA to PM's?&lt;/p&gt;

&lt;p&gt;(eg - hackathons)&lt;/p&gt;

</description>
      <category>remote</category>
      <category>culture</category>
      <category>help</category>
    </item>
    <item>
      <title>Résumé reviewer tag?</title>
      <dc:creator>Matthew Bidewell</dc:creator>
      <pubDate>Wed, 24 Jan 2018 20:23:42 +0000</pubDate>
      <link>https://dev.to/mattbidewell/rsum-reviewer-tag-232g</link>
      <guid>https://dev.to/mattbidewell/rsum-reviewer-tag-232g</guid>
      <description>&lt;p&gt;For a potential new tag, we could have a CV/Résumé section where users submit PDFs of their CV/Résumé. &lt;/p&gt;

&lt;p&gt;Any thoughts?&lt;/p&gt;

</description>
      <category>meta</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Explain Big(O) Notation</title>
      <dc:creator>Matthew Bidewell</dc:creator>
      <pubDate>Fri, 18 Aug 2017 09:11:03 +0000</pubDate>
      <link>https://dev.to/mattbidewell/explain-bigo-notation</link>
      <guid>https://dev.to/mattbidewell/explain-bigo-notation</guid>
      <description>&lt;p&gt;I believe I have the understanding, however I just want to double check with a community of developers. Good source links are recommended.&lt;/p&gt;

</description>
      <category>explainlikeimfive</category>
    </item>
    <item>
      <title>Whats on your desk?</title>
      <dc:creator>Matthew Bidewell</dc:creator>
      <pubDate>Mon, 14 Aug 2017 15:20:44 +0000</pubDate>
      <link>https://dev.to/mattbidewell/whats-on-your-desk</link>
      <guid>https://dev.to/mattbidewell/whats-on-your-desk</guid>
      <description>&lt;p&gt;What do you have on your desk that helps you work/think? For example, I have a Frankenstein plush that I used to help debug code (rubber duck debugging style).&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>justforfun</category>
      <category>offtopic</category>
    </item>
    <item>
      <title>Hi, I'm Matthew</title>
      <dc:creator>Matthew Bidewell</dc:creator>
      <pubDate>Mon, 17 Jul 2017 11:38:16 +0000</pubDate>
      <link>https://dev.to/mattbidewell/hi-im-matthew-bidewell</link>
      <guid>https://dev.to/mattbidewell/hi-im-matthew-bidewell</guid>
      <description>&lt;p&gt;I have been coding for 4 years.&lt;/p&gt;

&lt;p&gt;You can find me on GitHub as &lt;a href="https://github.com/MattBidewell" rel="noopener noreferrer"&gt;MattBidewell&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I live in Borehamwood/Hertfordshire.&lt;/p&gt;

&lt;p&gt;I mostly program in these languages: Java.&lt;/p&gt;

&lt;p&gt;Nice to meet you.&lt;/p&gt;

</description>
      <category>introduction</category>
    </item>
  </channel>
</rss>
