5 surprising features in Amazon’s Lambda serverless offering
Amazon is building out it’s serverless offering at a rapid clip. Lambda makes a great solution for a lot of different use cases including:
o a hybrid approach, building lambda functions for small pieces of your application, sitting along side your full application, working in concert with it
o working with Kinesis firehose to add ETL functionality into your pipeline. Extract Transform & Load is a method of transforming data from a relational or backend transactional databases, into one better fit for reporting & analytics.
o retrofitting your API? Layer Lambda functions in front, to allow you to rebuild in a managed way.
o a natural way to build microservices, with each function as it’s own little universe
Join 32,000 others and follow Sean Hull on twitter @hullsean.
Great, tons of ways to put serverless to use. What’s Amazon doing to make it even better? Here are some of the features you’ll find indispensible in building with Lambda.
1. Versioned functions
As your serverless functions get more sophisticated, you’ll want to control & deploy different versions. Lambda supports this, allowing you to upload multiple copies of the same function. Coupled with Aliases below, this becomes a very powerful feature.
As you deploy multiple versions of your functions in AWS, you don’t want to recreate the API endpoints each time. That’s where aliases come in. Create one alias for dev, another for test, and a third for production. That way when new versions of those are deployed, all you have to do is change the alias & QA or customers will be hitting the new code. Cool!
3. Caching & throttling
Using the API gateway, we can do some fancy footwork with Lambda. First we can enabling caching to speedup access to our endpoint. Control the time-to-live, capacity of the cache easily. We’ll also need to invalidate the cache when we make changes & redeploy our functions.
Throttling is another useful feature, allowing you to control the maximum number of times your function can be called per second on average (the rate) and maximum number of times (burst limit). These can be set at both the stage & method levels.
4. Stage variables
Creating multiple stages, for dev, test & production means you can separate out and control environment variables with more granular control. For example suppose you have access & secret keys to reach S3. You can set environment variables for these to avoid committing any credentials or secrets in your code. Definitely don’t do that!
Allowing multiple copies of stage variables, means you can set them separately for dev, test & production.
You can enable logging in your Lambda function configuration. This will send error and/or info warning messages out to CloudWatch.
You may also choose the log all of the request & response data. This is controlled in the API Gateway settings for individual stages.
Get more. Grab our exclusive monthly Scalable Startups. We share tips and special content. Our latest Why I don’t work with recruiters
Originally published at Scalable Startups.