Dicanio Rol

Dicanio Rol

1598949443

Route Management Frameworks for AWS Lambda and NodeJS

What is a Route Management Framework?

Most software engineers who’ve built and delivered production software have encountered the need for route management frameworks. These frameworks are designed and built to ease the development & management of  REST APIs inside NodeJS-based applications

Image for post

Traditional route management framework inside an API application

The most popular use of route management frameworks is that they enable us to express ROUTES that our REST APIs expose to consuming parties (web apps, backend workers, customer applications) and** assign them a specific execution logic** on how to handle requests that were received by our servers.

Some of the most popular route management frameworks in NodeJS are Express JS, Restify, Fastify, Loopback, Hapi JS, Koa, Loopback, etc.

#javascript #web-development #serverless #aws #nodejs

What is GEEK

Buddha Community

Route Management Frameworks for AWS Lambda and NodeJS
Valerio Tana

Valerio Tana

1594821831

Invoke AWS Lambda with Another Lambda Function with Nodejs

In this article, I will show you how to invoke a lambda function from another lambda function.

This invocation is most helpful in scenarios where you have layers or have common inputs to two functions, but they can’t be integrated, in such cases, we use the invoke method. Well, this is just one of the reasons, there are infinitely many reasons to use this based on your requirement.

For this, I have created two functions, **triggerLambdaFunction **and testFunction. While creating a Lambda function make sure you assign the IAM Role for Lambda, which has Policies of “AWSLambdaFullAccess” attached to it as shown below.

Image for post

IAM Role to be used in lambda functions

The “testFunction” is the one we are going to trigger using another lambda function called “triggerLambdaFunction”. Both are created in the same way and here I’m using Node.js to write the functions.

Image for post

Creating a new Lambda Function

In this triggerLambdaFunction, we have a FunctionCode window where we write our code to invoke another function using AWSLambda-invoke method which is defined in AWS.Lambda-class. So to use this method we should first import our AWS-SDK in the function. This is done to provide JavaScript objects for our AWS service.

#nodejs #lambda #aws #aws-lambda

 A Powerful NodeJS Framework to Manage Your AWS Lambda Functions.

When working with AWS services, you’ve got several choices to build and deploy your lambda functions: Serverless Framework, AWS Amplify Framework, and AWS SAM CLI are the three most popular toolkit today. Each of them has different pros and cons. The cons you will get just happens after your project sized to be a complex solution beyond their pre-designed, intended purpose. In this article, I want to introduce yet another choice for your work with less locked-in, highly customization, and ultimate control of your Infrastructure as Code solution.

Image for post

What is Simplify-SDK? This is a JavaScript SDK that helps your DevOp integration easier by adding deployment steps inline to your project solution. You will never want to be locked into any vendor for a tool you use. In FaaS architecture, a function can be very small but a project needs some (3–100) functions to orchestrate a workload. One CI/CD tool for all of them is quite hard to deploy your project when you just need to manage a stand-alone function.

#aws #simplify-framework #cloudformation #nodejs #lambda #function

Cache secrets using AWS Lambda extensions

What is the AWS Lambda extension?

A month back AWS announced a preview of Lambda Extensions, a new way to easily integrate Lambda with your favorite monitoring, observability, security, and governance tools. Extensions can be published as Lambda layers, there are two types are extension:

  • Internal extensions → Run as part of the runtime process, in-process with your code. Internal extensions enable use cases such as automatically instrumenting code.
  • External extensions → Allow you to run separate processes from the runtime but still within the same execution environment as the Lambda function. External extensions can start before the runtime process and can continue after the runtime shuts down. These extensions run as companion processes to Lambda functions.

#aws #aws-secrets-manager #lambda #aws lambda

Seamus  Quitzon

Seamus Quitzon

1601341562

AWS Cost Allocation Tags and Cost Reduction

Bob had just arrived in the office for his first day of work as the newly hired chief technical officer when he was called into a conference room by the president, Martha, who immediately introduced him to the head of accounting, Amanda. They exchanged pleasantries, and then Martha got right down to business:

“Bob, we have several teams here developing software applications on Amazon and our bill is very high. We think it’s unnecessarily high, and we’d like you to look into it and bring it under control.”

Martha placed a screenshot of the Amazon Web Services (AWS) billing report on the table and pointed to it.

“This is a problem for us: We don’t know what we’re spending this money on, and we need to see more detail.”

Amanda chimed in, “Bob, look, we have financial dimensions that we use for reporting purposes, and I can provide you with some guidance regarding some information we’d really like to see such that the reports that are ultimately produced mirror these dimensions — if you can do this, it would really help us internally.”

“Bob, we can’t stress how important this is right now. These projects are becoming very expensive for our business,” Martha reiterated.

“How many projects do we have?” Bob inquired.

“We have four projects in total: two in the aviation division and two in the energy division. If it matters, the aviation division has 75 developers and the energy division has 25 developers,” the CEO responded.

Bob understood the problem and responded, “I’ll see what I can do and have some ideas. I might not be able to give you retrospective insight, but going forward, we should be able to get a better idea of what’s going on and start to bring the cost down.”

The meeting ended with Bob heading to find his desk. Cost allocation tags should help us, he thought to himself as he looked for someone who might know where his office is.

#aws #aws cloud #node js #cost optimization #aws cli #well architected framework #aws cost report #cost control #aws cost #aws tags

Cross-account access to invoke AWS lambda using AWS CDK

If you are here, you may have a pretty good knowledge of how to use AWS CDK for defining cloud infrastructure in code and provisioning it through AWS. So let’s get started on how to grant permission to your lambda function to access the resources in another AWS account.

Let’s say you have two accounts called Account A and Account B, and you need to give permission to lambda function in Account A (ex: 11111111)to access the resources in Account B(22222222). You can easily do this by assuming an IAM Role in Account B and then uses the returned credentials to invoke AWS resources in Account B.

#acces #account #aws #lambda #aws lambda #aws cdk