Amazon.com chief technology officer Werner Vogels is a true computer science geek. You can tell by the way he threw shade on Python at this year’s AWS re:Invent user conference.
During his keynote, Vogels announced a number of new features to the AWS Lambda stateless computing service, including the ability to run Python scripts.
“I didn’t know programming languages with significant white space were still popular,” Vogels said, referring to Python’s use of indention for control flow, considered an annoyance to some.
Nonetheless, users of the Lambda service had been requesting Python almost since the service’s beta debut at last year’s re:Invent. The Python support was one of a number of new Lambda features introduced at the conference. Collectively, they show AWS remains serious about standing behind this somewhat singular cloud service.
AWS Lambda was devised to run user-generated functions in the cloud, without the need for the user to worry about any of the supporting stack running said functions. Not so much a Platform-as-a-Service as a Function-as-a-Service (We won’t use “FaaS” if you don’t).
Lambda is a stateless computer service, meaning it runs a user-defined function that collects data from an outside service, works on the data in some way, and delivers the output to some other service.
The code has to be triggered by an external event, such as incoming call from a mobile app, web service or by another AWS service. A change in an Amazon S3 bucket or DynamoDB table can trigger a function call.
Lambda is novel in that it strips away all the need to worry about any supporting infrastructure. No more maintaining EC2 instances just to run a single function. Infrastructure issues such as scaling or maintenance are whisked away in abstraction.
“You just give the work to Lambda, and it will do the compute on your behalf, ” said AWS Lambda general manager Tim Wagner in a breakout session later in the conference. “So the problem of having too many or too few servers doesn’t occur.”
Typical Lambda jobs include image conversion, change notifications and file compression — in fact, AWS has prebuilt functions available to handle those specific tasks.
At the conference, Amazon touted Lambda as a great way to coordinate operations of so-called Internet-of-Things systems. “You can do both data ingestion and command-and-control by sending those requests and commands down to the end-device,” Wagner said.
A Lambda job, for instance, could be used for inbound rule processing. Spam detection could be a Lambda function, one that gets evoked for each new email. Log files can be monitored in real time.
How much does it cost to run a function? Users are charged for every 100ms that the code executes and for the number of times the code is triggered. They can control how quickly the job executes with a compute power-dial of sorts, with 23 levels, expressed in terms of the amount of memory used. The more power, the faster the job gets done, though with slow I/O, more power is usually just wasteful and unduly expensive. And in case you wonder about stats: Lambda performance metrics are captured by Amazon CloudWatch.
Lambda can “change the way you build your applications and manage your applications,” Vogels said. “No server is easier to manage than no server.”
Lambda has seemingly worked out well for Amazon since the service launched as a full commercial offering in April. Amazon has added a bunch of new features, giving Lambda the chops to be incorporated into production environments.
Despite Vogels’ snub, the addition of Python is kind of a big deal. The audience seemed more pleased than Vogels, anyway.
Lambda is running stock Python 2.7 and users can get a hand from the AWS Python SDK to call into other AWS services such as S3 and EC2.
Another new feature of Lambda is the ability to run functions for up to five minutes at a time, up from a minute. Heavy video transcoding or large log file analysis jobs will be more feasible with this new upper limit. The developer specifies how much time a function can take before the five-minute limit brings it to a halt, and AWS even helpfully offers a context object to provide the function with how much time it has left in its highly mortal coil.
Also new: Successive changes in a Lambda function can be assigned — and be called by — specific immutable version numbers. With this feature, the dev can easily roll a function back to an earlier version if the new one takes a dive. Or, a legacy client can be pointed to an older version if required functionality isn’t supported in a newer one.
Version numbers can also act as aliases, offering pointers to whichever version the developer wants a client to call at that time.
Cron also makes its debut in Lambda. Those of the Unix ilk have long used the cron function to schedule jobs to run at a specific times. The cron format has been replicated for Lambda, providing a way to specify the minute, hour and/or day that a job can run.
Finally, users will soon be able to run Lambda jobs within their own virtual private clouds (VPCs).
This opens the possibility of using the service for in-house jobs and with internal resources, say the DynamoDB instance keeping marketing data. Security groups can be configured to accept inbound traffic from Lambda, and to give these functions access to other AWS services. The company plans to roll this feature out by the end of the year.
With Lambda, “You guys can build really cool stuff, even in Python,” Vogels snarked.