Download our Free AWS Pricing Calculator Spreadsheet. Download Now
In the past two blog posts, we’ve gone over what serverless and AWS Lambda is, and how it works, as well as the benefits and challenges. Now, let’s talk about some use cases, and some ways for you to think about how you might use Lambda.
When you go to a theme park, you will often see fleets of photographers everywhere, because they want to sell pictures. These photographers are snapping pictures and scanning your ticket to associate those pictures with you. Behind the scenes, what might be happening is that those photos are streamed up over cellular connections from the camera itself, directly into a bucket in Amazon S3. A Lambda function can be triggered automatically based on the event of an object landing in that bucket.
So let’s imagine there’s a Lambda function there with the job of resizing that photo to a variety of different sizes and adding watermarks to these photos so they can’t be downloaded for free. The park probably also wants to associate that photo with the relevant person or ticket so that one year after the person was at the theme park, the theme park can send them a reminder email that says: “Do you remember when you were here?”
All of this is completely automatic, and there are no servers for you to manage. You just set up the rule, the event, and the execution time frame, which all happens automatically. It’s a revenue-generating product that’s happening on your behalf, with very little management.
We have a lot of firehouses in our lives, from social media streams to data streams. You can use Amazon Kinesis to load those in real-time into your AWS environment. Because AWS has integrated many of its services, a Lambda can automatically be triggered as events are located in the stream, and you can perform processing with a Lambda function. As that Kinesis stream increases and more data passes through it, Lambda will transparently scale behind the scenes to process it. For example, you may load a social media stream and want to do some analysis about trends and hashtags. Your Lambda could perform those, store the results in Amazon DynamoDB, and you could make that trend information available immediately for users to query.
The mobile use case could also be true for REST APIs. This is a use case where you could use the Amplify framework that I mentioned. In this case, you could have a Lambda triggered by an API Gateway, and that makes it really easy for you to have REST APIs that are powered by Lambda. Those REST APIs are not Node.js applications, Ruby on Rails applications or Python applications that are specifically running on compute instance or in a containerized environment. They are hosted within the Lambda execution environment, and then when the API Gateway receives the request, it triggers the Lambda function, allowing you to process that request and return data.
In this case, the use case is a mobile application talking to the API gateway via REST API and triggering a Lambda function, which does things like updating friends list, pushing out Amazon push notifications, etc.
If you do have an environment where you have EC2 instances, you can leverage Lambda to do things like automated monitoring. This is a service that Mission provides part of our larger Managed Service offerings. We perform things like auto healing and implement Amazon CloudWatch alarms that leverage Lambda functions. So as instances get deployed and tagged, Lambda functions can create alarms based on monitoring tags. This enables you to automate a lot of these processes and ensure that the right monitors are being created on an automated basis.
Wouldn’t it be nice if you had automated documentation of your inventory? That is something you can actually do with a Lambda function. You can audit your environment, query your environment, and generate HTML-based documentation, upload to an S3 bucket, and more. This is a service Mission has provided as well.
AWS Lambda is a serverless environment for code execution. AWS has many more services that are serverless by nature including:
Amazon Aurora – On-demand, auto-scaling Relational Database Management System (RDBMS) that spins and scales on-demand. You only pay for your storage and execution time for queries.
AWS Fargate – Zero-management, auto-scaling containers interactive environment that is more in-depth and has more control of your environment than AWS Lambda does.
Amazon S3 – Original serverless object storage service, but you can perform compute services.
Amazon API Gateway – Fully-managed API environment.
Amazon SNS – Publish-Subscribe (Pub/Sub) messaging.
Amazon Kinesis – Streaming data processing.
All features offer similar benefits to AWS Lambda, such as no management, transparent scaling, and low obscurity of cost.
Thanks for tuning in to the Making Sense of Serverless blog series!