All Projects β†’ jordaneremieff β†’ mangum-cli

jordaneremieff / mangum-cli

Licence: MIT License
CLI tools for use with Mangum

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to mangum-cli

Hello Lambda
πŸ”₯ An example of a Python (AWS) Lambda exposed with API Gateway, configured with Terraform.
Stars: ✭ 114 (+714.29%)
Mutual labels:  aws-lambda, api-gateway
Zappa
Serverless Python
Stars: ✭ 11,859 (+84607.14%)
Mutual labels:  aws-lambda, api-gateway
Aws Lambda Blog
AWS Lambda serverless blogging platform
Stars: ✭ 119 (+750%)
Mutual labels:  aws-lambda, api-gateway
React Apig Lambda
Render React.js on-demand with CDN caching
Stars: ✭ 93 (+564.29%)
Mutual labels:  aws-lambda, api-gateway
nestjs-graphql-serverless
Boilerplate for using NestJS with GraphQL (Code-First) on serverless environment (AWS Lambda)
Stars: ✭ 64 (+357.14%)
Mutual labels:  aws-lambda, api-gateway
Jrestless
Run JAX-RS applications on AWS Lambda using Jersey. Supports Spring 4.x. The serverless framework can be used for deployment.
Stars: ✭ 93 (+564.29%)
Mutual labels:  aws-lambda, api-gateway
Serverless Next.js
⚑ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+21164.29%)
Mutual labels:  aws-lambda, api-gateway
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (+264.29%)
Mutual labels:  aws-lambda, api-gateway
Yoyo
A dead simple comment engine built on top of AWS lambda and React, alternative comment service to Disqus.
Stars: ✭ 210 (+1400%)
Mutual labels:  aws-lambda, api-gateway
Serverless Sinatra Sample
Demo code for running Ruby Sinatra on AWS Lambda
Stars: ✭ 195 (+1292.86%)
Mutual labels:  aws-lambda, api-gateway
Scandium
πŸš€ Easily deploy any Node.js web server to AWS Lambda
Stars: ✭ 61 (+335.71%)
Mutual labels:  aws-lambda, api-gateway
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (+114.29%)
Mutual labels:  aws-lambda, api-gateway
Up
Up focuses on deploying "vanilla" HTTP servers so there's nothing new to learn, just develop with your favorite existing frameworks such as Express, Koa, Django, Golang net/http or others.
Stars: ✭ 8,439 (+60178.57%)
Mutual labels:  aws-lambda, api-gateway
Serverless Sharp
Serverless image optimizer for S3, Lambda, and Cloudfront
Stars: ✭ 102 (+628.57%)
Mutual labels:  aws-lambda, api-gateway
Aws Power Tuner Ui
AWS Lambda Power Tuner UI is an open source project creating a deployable easy to use website built on a layered technology stack allowing you to optimize your Lambda functions for cost and/or performance in a data-driven way via an easy to use UI.
Stars: ✭ 52 (+271.43%)
Mutual labels:  aws-lambda, api-gateway
Serverless Architectures Aws
The code repository for the Serverless Architectures on AWS book
Stars: ✭ 120 (+757.14%)
Mutual labels:  aws-lambda, api-gateway
Corgi
AWS Lambda / API Gateway native, fast and simple web framework
Stars: ✭ 44 (+214.29%)
Mutual labels:  aws-lambda, api-gateway
Aws Serverless Java Container
A Java wrapper to run Spring, Jersey, Spark, and other apps inside AWS Lambda.
Stars: ✭ 1,054 (+7428.57%)
Mutual labels:  aws-lambda, api-gateway
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: ✭ 171 (+1121.43%)
Mutual labels:  aws-lambda, api-gateway
Apilogs
Easy logging and debugging for Amazon API Gateway and AWS Lambda Serverless APIs
Stars: ✭ 216 (+1442.86%)
Mutual labels:  aws-lambda, api-gateway

Mangum CLI

This package provides a command-line interface for generating AWS Lambda & API Gateway deployments used with Mangum.

Note: This is a work-in-progress. PRs welcomed.

Requirements: Python3.7+

Installation

pip install mangum-cli

Commands

mangum init - Create a new deployment configuration.

mangum build - Create a local build.

mangum deploy - Deploy the packaged project.

mangum package - Package the local build.

mangum all - build, package, and deploy.

mangum describe - Retrieve the endpoints for the deployment.

mangum validate - Validate the AWS CloudFormation template.

mangum delete - Delete the CloudFormation stack.

Tutorial

The steps below outline a basic FastAPI deployment, however you should be able to use any ASGI framework/application with the adapter.

Step 1 - Create a local project

First, create a new directory app/, this is the folder that will contain the main application code and function handler.

Then create a file asgi.py with the following:

from mangum import Mangum
from fastapi import FastAPI


app = FastAPI()


@app.post("/items/")
def create_item(item_id: int):
    return {"id": item_id}


@app.get("/items/")
def list_items():
    items = [{"id": i} for i in range(10)]
    return items


@app.get("/")
def read_root():
    return {"Hello": "World!"}


handler = Mangum(app)

This demonstrates a basic FastAPI application, the most relevant part is:

handler = Mangum(app)

The handler variable will be used as the handler name defined in the CloudFormation template to be generated later.

Lastly, create a requirements.txt file to include Mangum and FastAPI in the build:

mangum
fastapi

Step 2 - Create a new deployment configuration

Run the following command with a name for the project (required) and optionally include the name of an S3 bucket, the region and the runtime version (these values can be changed later):

mangum init <name> [bucket-name] [region-name] [runtime]

After defining the configuration a mangum.yml file will be generated, the current directory should now look this:

β”œβ”€β”€ app
β”‚   └── asgi.py
β”œβ”€β”€ mangum.yml
└── requirements.txt

Step 3 - Create a local build

Run the following command to create a local application build:

mangum build

This will create a build/ directory containing the application code and any dependencies included in requirements.txt.

Step 4 - Package the local build

Run the following command to package the local build:

mangum package

This wraps the AWS CLI's package command, it uses the definitions in mangum.yml to produce a packaged.yml file and a template.yml file.

Step 5 - Deploy the packaged build

Run the following command to deploy the packaged build:

mangum deploy

This wraps the AWS CLI's deploy command. It may take a few minutes to complete. If successful, the endpoints for the deployed application will be displayed in the console.

Step 6 - Delete CloudFormation stack

Run the following command to delete the CloudFormation stack:

mangum delete

Appendix.A - Enable shell completion.

You can enable shell completion by running the install option.

mangum complement bash

Candidates can be displayed by pressing the tab key.

$ mangum [TAB][TAB]
all            complement     delete         describe       package
build          create-bucket  deploy         init           validate

Appendix.B - build, package, and deploy.

If you want to execute build, package, and deploy sequentially, do as follows:

mangum all
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].