The 2016 AWS re:Invent will take place in Las Vegas in less than a week. We are all expecting big updates, especially regarding one of the AWS suite’s highest trending and pervasive services: Lambda.
In the past few days, AWS announced some interesting updates, and I assume that they are just preparing the ground for bigger news during the event.
Here is a short recap of what AWS has announced so far.
How many times have you hard-coded sensitive information directly in your Lambda Function code?
How often have you deployed a “production” Lambda Function with the wrong “development” keys?
How many identical Lambda Functions have you re-deployed just because a simple configuration parameter had changed?
I bet many of you have been avoiding ugly workarounds in favor of sophisticated automation tools (such as the Serverless Framework) to solve most of these problems.
Either way, you can finally configure Environment Variables natively on AWS Lambda by using the AWS KMS secure storage. It means that your variable values will be securely encrypted and retrieved by AWS when needed.
The interesting part is that you won’t need to change your Lambda Function code much, as you can simply read the variable values from the standard environment of each Runtime (e.g. process.env in Node.js, os.environ in Python, etc.).
I’d like to highlight two important details of this new feature:
AWS SAM appears to be the new name of Flourish, which is aimed at becoming the first vendor-neutral reference for Serverless applications.
In practice, AWS SAM makes it easy to define all of the resources used by a Serverless application. The new model will allow you to create specific resources that are optimized for serverless apps with Amazon CloudFormation. This is incredibly useful for all of the automation tools and frameworks that already help you with the deployment and management of Lambda Functions, API Gateway APIs, DynamoDB Tables, etc.
Technically, you can finally define a Serverless application with only a few lines of text. Indeed, you can use the new AWS::Serverless CloudFormation namespace.
Here is a list of the new resource types:
For example, here is how you’d define a simple read-only API connected to a DynamoDB table:
AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 Description: Ready-only access to DynamoDB table. Resources: MyReadOnlyFunction: Type: AWS::Serverless::Function Properties: Handler: index.get Runtime: python27 Policies: AmazonDynamoDBReadOnlyAccess Environment: Variables: TABLE_NAME: !Ref ItemsTable Events: ReadItem: Type: Api Properties: Path: /item/{itemId} Method: get ItemsTable: Type: AWS::Serverless::SimpleTable
Unfortunately, some of the native Lambda event sources are not supported yet—namely, AWS CodeCommit—but I am looking forward to its upcoming improvements and how it will change the development workflow of Serverless applications. If you want to learn more, you can find the project on GitHub.
I have personally met many AWS users who have been waiting for this feature for a long time. API Gateway only supported JSON payloads and responses, and the implementation of API resources related to multimedia has been pretty hard, or hacky, at least.
You can now provide binary payloads—e.g. a big PNG image—and expect binary responses such as a resized PNG image.
To achieve this, you simply have to define two options:
Unfortunately, the new contentHandling property is not fully supported by API Gateway Resources backed by AWS Lambda, for which the request body is always converted to JSON. I’m looking forward to furthering improvements on this front.
Another interesting use case has always been the possibility to serve gzipped responses with API Gateway and Lambda, which makes sense if the size of your JSON responses is big enough and easy to cache. So far, the only available alternative is serving an API Gateway through an additional CloudFront distribution or implementing a custom decompression functionality on your client.
The Serverless ecosystem is evolving on many fronts, and many other actors are working hard to make an impact on the Serverless revolution. The following updates are not strictly related to AWS and won’t be affected by the upcoming AWS re:Invent, but are definitely worth mentioning.
If you are interested in Serverless updates, you can check our blog’s Serverless archive. Here is a selection of our serverless material:
The Serverless Framework has changed a lot since we first talked about it six months ago. It was only in version 0.5 and a lot has happened in just a few months, including their $3M fundraising.
After Version 1.0 was released on October 12, the development team at serverless.com committed to a bi-weekly release plan, and they’ve just announced version 1.2, which includes the following:
You can find all of the scheduled milestones on GitHub. The next version, 1.3, is due on November 30 and it will bring more exciting features. Not to mention are all of the new, top-secret announcements yet to come during the AWS re:Invent.
For example, they have just disclosed a new open-source project called Serverless Dashboard. It will represent a new user-friendly layer on top of the Serverless CLI to enhance the framework user experience.
Here is a screenshot of the native app for Mac, which you can find on GitHub:
Microsoft released its Function as a Service in preview only eight months ago. It supports C#, JavaScript, Python, and PHP.
This new serverless platform is gaining traction with big enterprises and small startups in the Microsoft ecosystem. In fact, it is creating a new Application Model under the Azure App Services, in addition to a whole new series of services such as the Azure Bot Service.
I am looking forward to more features coming soon, as well as its integration in the Serverless Framework.
Choosing Docker as a packaging mechanism makes IronFunctions language-agnostic, although the team also decided to support the AWS Lambda packaging format to improve portability, and they announced that they would support others soon.
AWS announced Lambda at its 2014 re:Invent, and I’d expect much more news from this year’s event. Since then, Serverless has become a global movement. Each Cloud provider has built its own serverless solution—with different approaches and benefits—and at the same time, hundreds of local communities have gathered to share serverless ideas, wishlist items, and problems.
Here is my personal serverless wishlist for the upcoming months. I hope that AWS will surprise me next week!
Let us know if you have interesting improvements to add to our wishlist, and meet us at AWS re:Invent next week!
It's Flash Sale time! Get 50% off your first year with Cloud Academy: all access to AWS, Azure, and Cloud…
In this blog post, we're going to answer some questions you might have about the new AWS Certified Data Engineer…
This is my 3rd and final post of this series ‘Navigating the Vocabulary of Gen AI’. If you would like…