Learn About Amazon web Service Lambda

Hello,in this blog we are learning about AWS Lambda.AWS Lambda is a part of amazon web service & using lambda function we can build,test & deploy the code.It is an open source cloud platform service.It helps to focus on core product and business logic instead of managing operating system (OS) access control, OS patching, right-sizing, provisioning, scaling, etc.

What is AWS Lambda?

Amazon Web Service (AWS) is an open source cloud platform.It provides multiple services such as EC2,RDS,S3,VPC & lambda etc.AWS provides serverless computing service like AWS lambda.AWS lambda is a serverless computing service provided by Amazon as a part of Amazon Web Services(AWS). Serverless generally refers to serverless applications.Serverless applications are ones that don’t need any server provision and do not require to manage servers.Using Lambda,we run code on a high-availability compute infrastructure without provisioning or managing servers & & performs all compute resources, including server and operating system maintenance,automatic scaling, and logging.We don’t need to care about which AWS resources to launch, or how will you manage them.Instead,we only need to put code on lambda & its run.

AWS lambda supports different programming languages code such as Node.js, Python, Java and C#. Developers can also use code compiler tools, such as Maven or Gradle, and packages to build functions.It limits the amount of compute and storage resources in aws that we can use to run and store functions.

Build using Lambda function:

Web applications: Using AWS Lambda & other aws services,developers can build web applications that scale up and down and run in multiple data centers.

Mobile backends: Using AWS Lambda,we can build backends and Amazon API Gateway for the authentication and execution of API requests.

IoT backends:  Using AWS Lambda,we can build serverless backends to handle web, mobile, Internet of Things (IoT), and 3rd party API requests.

Data changes: Using AWS Lambda,we can perform data validation, filtering, sorting, or other transformations for every data change in a DynamoDB table and load the transformed data to another data store.

Real-time stream processing: Using AWS Lambda and Amazon Kinesis, we can process real-time streaming data for application activity tracking, transaction order processing, click stream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering.

Lambda features:

  • Concurrency and scaling controls,give the fine-grained control over the scaling and responsiveness of production applications.
  • Use the preferred container image tooling, workflows, and dependencies to build, test, and deploy the Lambda functions.
  • Code signing for Lambda provides trust and integrity control.
  • Use Lambda extensions to augment Lambda functions.
  • A function blueprint provides sample code that display how to use Lambda with other AWS services or third-party applications.
  • A database proxy manages a pool of database connections and relays queries from a function.
  • We can configure a function to mount an Amazon Elastic File System (Amazon EFS) file system to a local directory.

Create AWS Lambda function,click on the following link:

https://www.hackerxone.com/2021/05/30/how-create-lambda-function-amazon-web-serviceaws/

Sample Code for Test

import json
import boto3
ec2list = []
def lambda_handler(event, context):
# Get list of regions
ec2 = boto3.client('ec2')
regions = ec2.describe_regions().get('Regions',[] )
# Iterate over regions
for region in regions:
print ("* Checking region -- %s " % region['RegionName'])
reg=region['RegionName']
client = boto3.client('ec2', region_name=reg)
response = client.describe_instances()
for reservation in response["Reservations"]:
for instance in reservation["Instances"]:
print (" ---- Instance %s in %s" % (instance['InstanceId'], region['RegionName']))
ec2list.append(instance['InstanceId'])

Leave a Reply