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

The Advent of SQL 2024 Has Commenced

  It's Advent - the time of year when we countdown the days to Christmas - and if your are a programmer complete daily coding challenges with the Advent of Code, the Advent of Perl, the Advent of Java, Javascriptmas, etc. Now we have the Advent of SQL too with 24 SQL challenges to complete before Christmas! https://www.i-programmer.info/news/204-challenges/17678-the-advent-of-sql-2024-has-commenced.html

Greenplum's Cloudberry Fork Enters Apache Incubator

  Cloudberry is the open source equivalent of Greenplum. Now it is fostered by the Apache Foundation as it acquires incubating status. It all began about six months ago. Greenplum's Github repositories was archived and went dark. This meant no more free new releases or security and bug fixes for its users. Why? Because in May 2024, Tanzu made the decision to close-source the project. https://www.i-programmer.info/news/84-database/17694-greenplums-cloudberry-fork-enters-apache-incubator-.html