Skip to main content

Serverless WSGI With AWS Lambda + API Gateway

Project description

Logo placeholder # Zappa Build Status #### Serverless WSGI with AWS Lambda + API Gateway

Zappa makes it super easy to deploy all Python WSGI applications on AWS Lambda + API Gateway. Think of it as “serverless” web hosting for your Python web apps.

That means:

  • No more tedious web server configuration!

  • No more paying for 24/7 server uptime!

  • No more worrying about load balancing / scalability!

  • No more worrying about keeping servers online!

Awesome!

This project is for the Zappa core library, which can be used by any WSGI-compatible web framework (which is pretty much all of them.) This library also handles:

  • Packaging projects into Lambda-ready zip files and uploading them to S3

  • Correctly setting up IAM roles and permissions

  • Automatically configuring API Gateway routes, methods and integration responses

  • Deploying the API to various stages of readiness

If you are looking for the version for your favorite web frameworks, you should probably try here:

  • `django-zappa <https://github.com/Miserlou/django-zappa>`__

  • flask-zappa (Coming soon!)

  • pyramid-zappa (Coming.. maybe?)

Usage

If you just want to use Zappa to deploy your web application, you’ll probably want to use a client library like django-zappa instead. But, if you want to create a new client library or use Zappa directly, you can follow the steps below.

You can install Zappa through pip:

$ pip install zappa

Then, you’ll want to call its main capabilities in order:

# Set your configuration
project_name = "MyProject"
api_stage = "Production"
s3_bucket_name = 'MyLambdaBucket'

# Make your Zappa object
zappa = Zappa()

# Load your AWS credentials from ~/.aws/credentials
zappa.load_credentials()

# Make sure the necessary IAM execution roles are available
zappa.create_iam_roles()

# Create the Lambda zip package (includes project and virtualenvironment)
zip_path = zappa.create_lambda_zip(project_name)

# Upload it to S3
zip_arn = zappa.upload_to_s3(zip_path, s3_bucket_name)

# Register the Lambda function with that zip as the source
# You'll also need to define the path to your lambda_handler code.
lambda_arn = zappa.create_lambda_function(s3_bucket_name, zip_path, project_name, 'runme.lambda_handler')

# Create and configure the API Gateway
api_id = zappa.create_api_gateway_routes(lambda_arn)

# Deploy the API!
endpoint_url = zappa.deploy_api_gateway(api_id, api_stage)

print("Your Zappa deployment is live!: " + endpoint_url)

And your application is live!

TODO

This project is very young, so there is still plenty to be done. Contributions are more than welcome! Please file tickets before submitting patches, and submit your patches to the ‘dev’ branch.

Things that need work right now:

  • Testing

  • Route53 Integration

  • SSL Integration

  • Clients for frameworks besides Django

  • Package size/speed optimization

  • Fix the “hot-start” problem

  • Feedback

  • A nifty logo

  • Real documentation / website!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zappa-0.5.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

zappa-0.5.0-py2-none-any.whl (14.8 kB view details)

Uploaded Python 2

File details

Details for the file zappa-0.5.0.tar.gz.

File metadata

  • Download URL: zappa-0.5.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zappa-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ea9bc3f67c0fabf289af69a09d9c16e64c83bf5189ad4a32bc5368f83d50aa0a
MD5 fb8c8ec5fdc19b8601ed5fe0286fc0c7
BLAKE2b-256 0cd254f502423606ab46c384e35180ff23119fff9f3e5074675c6eedfcb878ea

See more details on using hashes here.

Provenance

File details

Details for the file zappa-0.5.0-py2-none-any.whl.

File metadata

File hashes

Hashes for zappa-0.5.0-py2-none-any.whl
Algorithm Hash digest
SHA256 11c3ccfc8d26be46c567d9141d3c84ea7055728815ff052988c640ec7bfbc9f9
MD5 c7d12be0c3677ab3a650e2b3260ec664
BLAKE2b-256 f35a366f5000fb6a9262b922b509f26aa11af024db4253625c14d4ee9bceb983

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page