In this video, Jeff Winesett introduces AWS Lambda. AWS Lambda is one of the services AWS provides to help achieve serverless architectures.
- [Narrator] Cloud Computing has always been about abstraction and virtualization. One of the first offerings was virtual servers. With virtual servers the specific hardware and physical components like racks and chords and connections were abstracted out. The management and configuration effort was shifted only to the software running on these servers. In AWS, this level of abstraction is achieved with EC2, the virtual servers.
As Cloud Service offerings increased and matured more abstraction became available in the form on containers. With containers, the specific OS software and supporting network libraries are abstracted out leaving the user to only focus on specific application components. In AWS, some examples of services offering this level of abstraction are ECS and Elastic Beanstalk. Servers are still running but choices don't have to be made about the underlying OS and supporting packages and libraries on the infrastructure.
There is yet another level of abstraction available and what is often referred to as Serverless. At this level, the language runtime itself is being abstracted out and focuses instead turned only to the individual functions that are performing some specific tasks. AWS Lambda is the service that provides this level of abstraction. With Lambda, just specific coded functions are running only when they are needed and without any knowledge of the servers or OS or the language runtime configuration.
A snippet of code that is designed to perform some process is provided and the rest is taken care of by Lambda. The two primary components of AWS Lambda are the Lambda function itself and the Event source. The function part is simply some custom code that has been written and uploaded to the service. The Event source is something that is capable of publishing an Event that with invoke the function. Code is written to process Events and Event sources, publish Events for processing.
The Lambda function consists of custom code and some configuration. The additional configuration allows for the specification of several things. Such as which Handler should receive the incoming Event information, the IAM role information defining the set of permissions given to the Lambda function while running, the amount of Compute resource desired to be allocated during runtime, and how long the function should run before timing out. Event sources can be other AWS services that support publishing Events or custom applications written to publish Events and invoke Lambda functions.
There are many AWS services that can be configured as Event sources and this list will continue to grow. Some examples are S3, DynamoDB, Simple Notification Service, Kinesis streams, and the gateway API just to name a few. One very common use case of Lambda is in the designing of what is referred to as a Micro Services Architecture. This is typically accomplished by using the Amazon API gateway as the Event source for Lambda functions.
This is referred to as an on-demand invocation of Lambda. As explicit requests come into the API, and then the API invokes Lambda functions. Another common use case for Lambda is for file or data processing by using S3 as the Event source. S3 can publish Events of different types such as when objects are added, updated, copied, or deleted within Buckets. Using the Bucket notification feature, S3 can be configured to invoke a Lambda function when one of these Bucket Events occurs.
Here we show raw data being gathered from the internet and initially placed into an S3 Bucket. This raw data needs to be cleaned up and formatted before it can be used by some internal application. When the data is added to the S3 Bucket, S3 detects the Object Created Event and then invokes the Lambda function. S3 knows which Lambda function to invoke based on the Event source mapping that is stored in the Bucket notification configuration.
The Lambda function runs, cleans up the data and then writes it out to a data storage to be used by some internal application. Performance Optimization, Lesson Number Five. When thinking about Optimization, consider the level of abstraction that can be tolerated by the business use cases and application being designed. Remove as much maintenance and administrative overhead as possible. Consider using Lambda functions and focus solely on the business logic and functions needed to carry out the functionality of the application.
- Benefits of cloud services
- Making architectures scalable
- Examining cloud constraints
- Virtual servers, EC2, and Elastic IP
- Using the Amazon machine image
- Elastic load balancing
- Using CloudWatch for monitoring
- Security Models
- Elastic block storage
- S3, CloudFront, and Elastic Beanstalk
- Handling queues, workflows, and notifications
- Caching options and services
- Identity and access management
- Creating a custom server image
- Application deployment strategies
- Serverless architectures