Please enable JavaScript to view the comments powered by Disqus. A WalkThrough of AWS Lambda

 

 

 

 

A WalkThrough of AWS Lambda

NovelVista
NovelVista

Last updated 26/08/2021


A WalkThrough of AWS Lambda

Introduction - What Is Serverless?

Serverless most often refers to serverless applications. Serverless applications do not require you to provision or manage any servers. You can focus on your core product and business logic instead of responsibilities like an operating system (OS) access control, OS patching, provisioning, right-sizing, scaling, and availability. By building your application on a serverless platform, the platform manages these responsibilities for you.

For service or platform to be considered serverless, it should provide the following capabilities:

  • No server management ? You don?t have to provision or maintain any servers. There is no software or runtime to install, maintain, or administer.
  • Flexible scaling ? You can scale your application automatically or by adjusting its capacity through toggling the units of consumption (for example, throughput, memory) rather than units of individual servers.
  • High availability ? Serverless applications have built-in availability and fault tolerance. You don't need to architect for these capabilities because the services running the application provide them by default.
  • No idle capacity ? You don't have to pay for idle capacity. There is no need to pre-provision or over-provision capacity for things like computing and storage. There is no charge when your code isn?t running.

The AWS Cloud provides many different services that can be components of a serverless application. These include capabilities for:

  • Compute ? AWS Lambda
  • APIs ? Amazon API Gateway
  • Storage ? Amazon Simple Storage Service (Amazon S3)
  • Databases ?Amazon DynamoDB
  • Interprocess messaging ? Amazon Simple Notification Service (Amazon SNS) and Amazon Simple Queue Service (Amazon SQS)
  • Orchestration ? AWS Step Functions and Amazon CloudWatch Events
  • Analytics ? Amazon Kinesis

AWS Lambda 

AWS Lambda is a serverless compute service that lets you run code without provisioning or managing servers, creating workload-aware cluster scaling logic, maintaining event integrations, or managing runtimes. With Lambda, you can run code for virtually any type of application or backend service - all with zero administration. Just upload your code as a ZIP file or container image, and Lambda automatically and precisely allocates compute execution power and runs your code based on the incoming request or event, for any scale of traffic. You can set up your code to automatically trigger from 140 AWS services or call it directly from any web or mobile app. You can write Lambda functions in your favorite language (Node.js, Python, Go, Java, and more) and use both serverless and container tools, such as AWS SAM or Docker CLI, to build, test, and deploy your functions.

AWS Lambda functions

The code you run on AWS Lambda is called a ?Lambda function.? After you create your Lambda function it is always ready to run as soon as it is triggered, similar to a formula in a spreadsheet. Each function includes your code as well as some associated configuration information, including the function name and resource requirements. Lambda functions are ?stateless,? with no affinity to the underlying infrastructure, so that Lambda can rapidly launch as many copies of the function as needed to scale to the rate of incoming events.

After you upload your code to AWS Lambda, you can associate your function with specific AWS resources (e.g. a particular Amazon S3 bucket, Amazon DynamoDB table, Amazon Kinesis stream, or Amazon SNS notification). Then, when the resource changes, Lambda will execute your function and manage the compute resources as needed to keep up with incoming requests.

AWS Lambda features

Extend other AWS services with custom logic

AWS Lambda allows you to add custom logic to AWS resources such as Amazon S3 buckets and Amazon DynamoDB tables, making it easy to apply to compute to data as it enters or moves through the cloud.

It is easy to get started with AWS Lambda. First, you create your function by uploading your code (or building it right in the Lambda console) and choosing the memory, timeout period, and AWS Identity and Access Management (IAM) role. Then, you specify the AWS resource to trigger the function, either a particular Amazon S3 bucket, Amazon DynamoDB table, or Amazon Kinesis stream. When the resource changes, Lambda will run your function and launch and manage the compute resources as needed to keep up with incoming requests.

Build custom back-end services

You can use AWS Lambda to create new back-end services for your applications that are triggered on-demand using the Lambda API or custom API endpoints built using Amazon API Gateway. By using Lambda to process custom events instead of servicing these on the client, you can avoid client platform variations, reduce battery drain, and enable easier updates.

Bring your code

With AWS Lambda, there are no new languages, tools, or frameworks to learn. You can use any third-party library, even native ones. You can also package any code (frameworks, SDKs, libraries, and more) as a Lambda Layer and manage and share them easily across multiple functions. Lambda natively supports Java, Go, PowerShell, Node.js, C#, Python, and Ruby code, and provides a Runtime API that allows you to use any additional programming languages to author your functions.

Completely automated administration

AWS Lambda manages all the infrastructure to run your code on highly available, fault-tolerant infrastructure, freeing you to focus on building differentiated back-end services. With Lambda, you never have to update the underlying OS when a patch is released or worry about resizing or adding new servers as your usage grows. AWS Lambda seamlessly deploys your code, does all the administration, maintenance, and security patches, and provides built-in logging and monitoring through Amazon CloudWatch.

Built-in fault tolerance

Lambda has built-in fault tolerance. AWS Lambda maintains compute capacity across multiple Availability Zones in each region to help protect your code against individual machine or data center facility failures. Both AWS Lambda and the functions running on the service provide predictable and reliable operational performance. AWS Lambda is designed to provide high availability for both the service itself and for the functions it operates. There are no maintenance windows or scheduled downtimes.

Package and deploy functions as container images

AWS Lambda supports packaging and deploying functions as container images, making it easy for customers to build Lambda-based applications by using familiar container image tooling, workflows, and dependencies. Customers also benefit from the operational simplicity, automatic scaling with sub-second startup times, high availability, native integrations with 140 AWS services, and pay-for-use billing model offered by AWS Lambda. Enterprise customers can use a consistent set of tools with both their Lambda and containerized applications for central governance requirements such as security scanning and image signing.

Automatic scaling

AWS Lambda invokes your code only when needed and automatically scales to support the rate of incoming requests without requiring you to configure anything. There is no limit to the number of requests your code can handle. AWS Lambda typically starts running your code within milliseconds of an event, and since Lambda scales automatically, the performance remains consistently high as the frequency of events increases. Since your code is stateless, Lambda can start as many instances of it as needed without lengthy deployment and configuration delays.

Connect to relational databases

Use Amazon RDS Proxy to take advantage of fully managed connection pools for relational databases. RDS Proxy efficiently manages thousands of concurrent database connections to relational databases, making it easy to build highly scalable, secure, Lambda-based serverless applications that need to interact with relational databases. Currently, RDS Proxy offers support for MySQL and Aurora. You can use RDS Proxy for your serverless applications through the Amazon RDS console or the AWS Lambda console.

Fine-grained control over performance

Provisioned Concurrency gives you greater control over the performance of your serverless application. When enabled, Provisioned Concurrency keeps functions initialized and hyper-ready to respond in double-digit milliseconds. Provisioned Concurrency is ideal for any application built using AWS Lambda that needs greater control over function start time. You can easily configure the appropriate amount of concurrency that your application needs. You can increase the level of concurrency during times of high demand and lower it, or turn it off completely when demand decreases. Taking advantage of Provisioned Concurrency requires no changes to your code. Provisioned Concurrency is an efficient way to achieve consistent performance for latency-sensitive applications as you need it, without having to manage to compute resources.

Connect to shared file systems

With Amazon Elastic File System for AWS Lambda, you can securely read, write, and persist large volumes of data at low latency, at any scale. You don't need to write code to download data to temporary storage to process it. This saves time and simplifies the code, enabling you to focus on your business logic. EFS for Lambda is ideal for building machine learning applications or loading large reference files or models, processing or backing up large amounts of data, hosting web content, or sharing files between serverless applications and instance or container-based applications.

Run code in response to Amazon CloudFront requests

With Lambda@Edge, AWS Lambda can run your code across AWS locations globally in response to Amazon CloudFront events, such as requests for content to or from origin servers and viewers. This makes it easier to deliver richer, more personalized content to your end-users with lower latency. 

Orchestrate multiple functions

You can coordinate multiple AWS Lambda functions for complex or long-running tasks by building workflows with AWS Step Functions. Step Functions lets you define workflows that trigger a collection of Lambda functions using sequential, parallel, branching, and error-handling steps. With Step Functions and Lambda, you can build stateful, long-running processes for applications and backends.

Integrated security model

AWS Lambda allows your code to securely access other AWS services through its built-in AWS SDK and integration with AWS Identity and Access Management (IAM). AWS Lambda runs your code within a VPC by default. You can optionally also configure AWS Lambda to access resources behind your VPC, allowing you to leverage custom security groups and network access control lists to provide your Lambda functions access to your resources within a VPC.

AWS Lambda is SOC, HIPAA, PCI, ISO compliant. For the latest in Lambda certification and compliance readiness, please see the full services in scope.

Trust and integrity controls

Code Signing for AWS Lambda offers trust and integrity controls that allow you to verify that only unaltered code published by approved developers is deployed in your Lambda functions. You simply create digitally signed code artifacts and configure your Lambda functions to verify the signatures at deployment. This helps increase the speed and agility of your development, even within large development teams, while enforcing high-security standards.

Only pay for what you use

With AWS Lambda, you pay for execution duration rather than by server unit. When using Lambda functions, you only pay for requests served and the compute time required to run your code. Billing is metered in increments of 1 millisecond, making it cost-effective and easy to scale automatically from a few requests per day to thousands per second. With Provisioned Concurrency, you pay for the amount of concurrency that you configure and for the period that you configure it. When Provisioned Concurrency is enabled for your function and you execute it, you also pay for requests and execution duration. To learn more about pricing, please visit AWS Lambda Pricing.

Flexible resource model

You choose the amount of memory you want to allocate to your functions and AWS Lambda allocates proportional CPU power, network bandwidth, and disk I/O.

Integrate Lambda with your favorite operational tools

AWS Lambda extensions allow you to easily integrate Lambda with your favorite tools for monitoring, observability, security, and governance. Lambda extensions run within Lambda?s execution environment which is where your function code is executed. With Lambda extensions you can capture fine-grained diagnostic information and send function logs, metrics, and traces to a location of your choice. You can also integrate security agents within Lambda?s execution environment, all with no operational overhead and minimal impact on the performance of your functions.

Benefits

No servers to manage

AWS Lambda automatically runs your code without requiring you to provision or manage infrastructure. Just write the code and upload it to Lambda either as a ZIP file or container image.

Continuous scaling

AWS Lambda automatically scales your application by running code in response to each event. Your code runs in parallel and processes each trigger individually, scaling precisely with the size of the workload, from a few requests per day to hundreds of thousands per second.

Cost-optimized with millisecond metering

With AWS Lambda, you only pay for the compute time you consume, so you?re never paying for over-provisioned infrastructure. You are charged for every millisecond your code executes and the number of times your code is triggered. With Compute Savings Plan, you can additionally save up to 17%.

Consistent performance at any scale

With AWS Lambda, you can optimize your code execution time by choosing the right memory size for your function. You can also keep your functions initialized and hyper-ready to respond within double-digit milliseconds by enabling Provisioned Concurrency.

Use cases

What can you build with AWS Lambda? Learn more about the use cases below:

Data processing

You can use AWS Lambda to execute code in response to triggers such as changes in data, shifts in system state, or actions by users. Lambda can be directly triggered by AWS services such as S3, DynamoDB, Kinesis, SNS, and CloudWatch, can connect to existing EFS file systems, or it can be orchestrated into workflows by AWS Step Functions. This allows you to build a variety of real-time serverless data processing systems.

Real-time file processing

AWS Lambda File Processing

You can use Amazon S3 to trigger AWS Lambda to process data immediately after an upload. You can also connect to an existing Amazon EFS file system directly, which enables massively parallel shared access for large-scale file processing. For example, you can use Lambda to thumbnail images, transcode videos, index files, process logs, validate content, and aggregate and filter data in real-time.

Real-time stream processing

AWS Lambda Stream Processing

You can use AWS Lambda and Amazon Kinesis to process real-time streaming data for application activity tracking, transaction order processing, clickstream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering.

Machine learning

You can use AWS Lambda to pre-process data before feeding it to your machine learning model. With Lambda access to EFS, you can also serve your model for prediction at scale without having to provision or manage any infrastructure.

Backends

You can build serverless backends using AWS Lambda to handle web, mobile, Internet of Things (IoT), and 3rd party API requests. Take advantage of Lambda?s consistent performance controls, such as multiple memory configurations and Provisioned Concurrency, for building latency-sensitive applications at any scale.

Web applications

AWS Lambda Web Backend

By combining AWS Lambda with other AWS services, developers can build powerful web applications that automatically scale up and down and run in a highly available configuration across multiple data centers ? with zero administrative effort required for scalability, back-ups, or multi-datacenter redundancy.

IoT backends

AWS Lambda IoT Backend

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

Mobile backends

AWS Lambda Mobile Backend

AWS Lambda makes it easy to create rich, personalized app experiences. You can build backends using AWS Lambda and Amazon API Gateway to authenticate and process API requests. Use AWS Amplify to easily integrate your backend with your iOS, Android, Web, and React Native frontends.

 

Topic Related Post
Beyond the certification: Essential skills for landing your dream job as an AWS Solution Architect
Maximizing Efficiency and Minimizing Costs: Essential Strategies for AWS Solutions Architects
Azure Security Best Practices for AZ-104 Certified Professionals

About Author

NovelVista Learning Solutions is a professionally managed training organization with specialization in certification courses. The core management team consists of highly qualified professionals with vast industry experience. NovelVista is an Accredited Training Organization (ATO) to conduct all levels of ITIL Courses. We also conduct training on DevOps, AWS Solution Architect associate, Prince2, MSP, CSM, Cloud Computing, Apache Hadoop, Six Sigma, ISO 20000/27000 & Agile Methodologies.

 
 
SUBMIT ENQUIRY

* Your personal details are for internal use only and will remain confidential.

 
 
 
 
 
 
Upcoming Events
ITIL-Logo-BL ITIL

Every Weekend

AWS-Logo-BL AWS

Every Weekend

Dev-Ops-Logo-BL DevOps

Every Weekend

Prince2-Logo-BL PRINCE2

Every Weekend

Topic Related
Take Simple Quiz and Get Discount Upto 50%
Popular Certifications
AWS Solution Architect Associates
SIAM Professional Training & Certification
ITIL® 4 Foundation Certification
DevOps Foundation By DOI
Certified DevOps Developer
PRINCE2® Foundation & Practitioner
ITIL® 4 Managing Professional Course
Certified DevOps Engineer
DevOps Practitioner + Agile Scrum Master
ISO Lead Auditor Combo Certification
Microsoft Azure Administrator AZ-104
Digital Transformation Officer
Certified Full Stack Data Scientist
Microsoft Azure DevOps Engineer
OCM Foundation
SRE Practitioner
Professional Scrum Product Owner II (PSPO II) Certification
Certified Associate in Project Management (CAPM)
Practitioner Certified In Business Analysis
Certified Blockchain Professional Program
Certified Cyber Security Foundation
Post Graduate Program in Project Management
Certified Data Science Professional
Certified PMO Professional
AWS Certified Cloud Practitioner (CLF-C01)
Certified Scrum Product Owners
Professional Scrum Product Owner-II
Professional Scrum Product Owner (PSPO) Training-I
GSDC Agile Scrum Master
ITIL® 4 Certification Scheme
Agile Project Management
FinOps Certified Practitioner certification
ITSM Foundation: ISO/IEC 20000:2011
Certified Design Thinking Professional
Certified Data Science Professional Certification
Generative AI Certification
Generative AI in Software Development
Generative AI in Business
Generative AI in Cybersecurity
Generative AI for HR and L&D
Generative AI in Finance and Banking
Generative AI in Marketing
Generative AI in Retail
Generative AI in Risk & Compliance
ISO 27001 Certification & Training in the Philippines
Generative AI in Project Management
Prompt Engineering Certification
Devsecops Practitioner Certification
AIOPS Foundation Certification
ISO 9001:2015 Lead Auditor Training and Certification
ITIL4 Specialist Monitor Support and Fulfil Certification
Generative AI webinar
Leadership Excellence Webinar
Certificate Of Global Leadership Excellence
ISO 27701 Lead Auditor Certification
Gen AI for Project Management Webinar
Certified Cloud Tester Foundation
HR Business Partner Certification
Chief Learning Officer Certification
Gen AI in Cybersecurity Webinar
Six Sigma Webinar
Gen AI Powered ITSM Webinar
PM Prince2 PMP Webinar
Certified Generative AI Expert
GCP Professional Cloud Architect
GitHub Copilot Training Program
Certified Service Desk Professional
Certified Generative AI in ITSM