Skip to main content

AWS Lambda For The Impatient Part 2

In the first part of the AWS Lambda for the Impatient tutorial series we set to create our very first lambda function and call it through an open, public, unrestricted and unauthenticated endpoint.This time around we add security so that calling our lambdas will require the client to authenticate through an IAM Role and User name.

Step 1 - Create a new Lambda function and API Gateway endpoint
As happened in the first part, we create a new lambda called lambda_basic_execution_helloWorldNodeJS but with the added suffix of _auth. So that we can tell it apart, call it lambda_basic_execution_helloWorldNodeJS_auth.
Despite the name change, the function's code remains the same as last time:
use strict';
exports.handler = (event, context, callback) => {
 console.log('Received event:',
                 JSON.stringify(event, null, 2));
 var inputObj = JSON.parse(event["body"]);
 callback(null, {
    "statusCode": 200,
    "headers": { },
 // Echo back the first key value
    "body": JSON.stringify(
                    {"received":inputObj.key1})
 })
}

Comments

Popular posts from this blog

RAG from Scratch

  The "RAG from Scratch" tutorial by Langchain coupled with the "RAG playground" are two great educational resources that will help you kickstart your journey with RAG. https://www.i-programmer.info/news/105-artificial-intelligence/17676-rag-from-scratch.html

Hour Of Code 2024 Is About To Kick Off

  This year the event that aims to provide a coding experience for all school students and anyone else who wants to join in runs between December 9th and 15th and includes new activities. Let's find out all about it! https://www.i-programmer.info/news/150-training-a-education/17664-hour-of-code-2024-is-about-to-kick-off.html