News

New Python Framework Expands AWS Serverless Offerings

"Serverless is a hot topic in the software architecture world," reads a post today on MartinFowler.com.

That's no news to Amazon Web Services Inc. (AWS), which jumped on the serverless bandwagon early on with multiple serverless cloud services, to which it has just added a new preview offering: the Python Serverless Microframework for AWS.

"Serverless computing is one of the most talked-about subjects among AWS customers," Peter Moon said this week in a post announcing the new service. "The AWS serverless offerings, AWS Lambda and Amazon API Gateway, make it possible for developers to create and run API applications with built-in, virtually unlimited scalability without managing any servers. Today the AWS Developer Tools team is excited to announce the preview of the Python Serverless Microframework for AWS."

AWS said the new microframework provides:

  • A command-line tool for creating, deploying and managing apps.
  • A familiar and easy-to-use API for declaring views in Python code.
  • Automatic Identity and Access Management (IAM) policy generation.

To clarify the serverless concept, ThoughtWorks has provided a definition:

Serverless architecture replaces long-running virtual machines with ephemeral compute power that comes into existence on request and disappears immediately after use. Examples include Firebase and AWS Lambda. Use of this architecture can mitigate some security concerns such as security patching and SSH access control, and can make much more efficient use of compute resources. These systems cost very little to operate and can have inbuilt scaling features (this is especially true for AWS Lambda). An example architecture could be a JavaScript app with static assets served by a CDN or S3 coupled with AJAX calls served by the API Gateway and Lambda. While serverless architectures have significant benefits, there are drawbacks too: Deploying, managing and sharing code across services is more complex, and local or offline testing is more difficult if not impossible.

To reduce some of those "drawbacks," AWS wants to take care of much of the nitty-gritty details, now enlisting in that effort Python, "a programming language that lets you work quickly and integrate systems more effectively."

That agility was demonstrated in the post by Moon.

"In just 45 seconds, I created a new Hello World project, inspected its code file (app.py), deployed it to a public API endpoint, and using curl, made a successful HTTP GET request to the endpoint. Because our goal is to minimize the time it takes to get started, we hope you’ll enjoy the simple and fast experience offered by the new microframework."

Moon demonstrated his coding in a three-minute video, using the framework's command-line tool called chalice.

In a FAQ, AWS explained the differences between its new offering and other similar frameworks:
The biggest difference between this framework and others is that the Python Serverless Microframework for AWS is singularly focused on using a familiar, decorator-based API to write Python applications that run on Amazon API Gateway and AWS Lambda. You can think of it as Flask/Bottle for serverless APIs. Its goal is to make writing and deploying these types of applications as simple as possible specifically for Python developers.

While Python developers can start experimenting with the new tool now and explore its Apache 2.0-licensed open source code, it's not yet ready for prime-time use. "The Python Serverless Microframework for AWS is available on PyPI (pip install chalice) and GitHub," Moon said. "It is published as a preview project and is not yet recommended for production APIs."

About the Author

David Ramel is the editor of Visual Studio Magazine.

Featured