Zappa | Serverless Python - Project moved to https : //github | Serverless library
kandi X-RAY | Zappa Summary
kandi X-RAY | Zappa Summary
Serverless Python
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Runs a lambda function
- Send a message to Lambda
- Sends a message
- Get the task path
- Get the stage configuration
- Handle a callback
- Update the function
- Check if a virtual environment is available
- Handle zappa
- Check if Zappa is available
- Check if a new version is available
- Handles the command line arguments
- Route a SNS task
- Import a task and return it
- Run the given message
- Decorator for task_sns tasks
- Decorator to turn a function into a task
- Deploy API Gateway
- Get the patch operation
- Update the stage configuration
- Route a lambda task
- Get the status of an event source
- Load zip file from S3
- Shortcut for deny methods
- Shortcut method to add an AllowMethod to the request
- Shortcut API to add an Allow method to the client
Zappa Key Features
Zappa Examples and Code Snippets
# Zappa 설치
(venv) $ pip install zappa
Successfully installed ... zappa-0.51.0 zipp-3.1.0
# 명령어들을 확인해봅니다.
(venv) $ zappa --help
usage: zappa [-h] [-v] [--color {auto,never,always}]
{certify,deploy,init,package,template,invoke,manage,roll
from zappa.handler import lambda_handler
import epsagon
epsagon.init(
token='epsagon-token',
app_name='app-name-stage',
metadata_only=False
)
# Your code is here
epsagon_handler = epsagon.lambda_wrapper(lambda_handler)
{
"lambda_han
---
title: The Title
author: Your Name
date-created: 01-01-2016
format: markdown
---
# Title title title
**Body** body body body.
$ ./zappa_cms.py
$ zappa deploy production
Community Discussions
Trending Discussions on Zappa
QUESTION
I recently uploaded an Django application with the use off Zappa, which was running perfectly fine.
Now, I wanted to update this application, and It suddenly gives me this error: (The changes I made wasn't really that much, removed a blank=True in my models.py)
...ANSWER
Answered 2022-Feb-09 at 11:13Don't exactly know what went wrong but I got it fixed by:
- completly removing my virtual environment
- creating a new one.
- installing packages with
pip install -r requirements.txt --no-cache-dir
the --no-cache-dir
was really important adding.
QUESTION
I’m doing some troubleshooting for a custom domain (purchased via Google). I’ve updated the custom resource record in Google, done the route 53 + AWS cert manager steps, and ran zappa certify (as well as zappa update). My first thought… is it supposed to show the AWS link after the custom domain: e.g.,
...ANSWER
Answered 2022-Jan-17 at 21:16Resolved my own issue ... simple mistake.
In Google Domains, I was using 'Default Name Servers' with CNAME customer records. Instead, I needed to use 'Custom Name Servers' and activated the 4 names servers from route 53. Hopefully this helps anyone who encounters similar troubleshooting w AWS/Google/Zappa!
QUESTION
In my project, I use Django as a frontend only. All backend logic is several AWS Lambda Python functions coordinated by the state machine. The database is SQLite in the S3 bucket. I use django_s3_storage
and django_s3_sqlite
. My backend functions change the number of model instances and their details in the SQLite database. I'd like those changes to be reflected by the Django frontend ASAP. However, it does not happen. I see only the outdated in-memory cache.
I have tried several things.
My initial view:
...ANSWER
Answered 2021-Nov-30 at 15:50Your Django Lambda container instances will download the SQLite DB on load and then will cache the file locally until the Lambda container is shut down by AWS. This is done automatically by the django_s3_sqlite
package.
Since you are making writes to the database using a separate backend system, the Django Lambda container instances are not aware of changes and thus will not re-download the SQLite DB from S3. The functions you list are all Django based caching and will have no effect.
If you want the Django app to reflect DB changes in a faster time period, you will need to migrate to a centralized database such as PostgreSQL on RDS or DynamoDB.
QUESTION
I have a flask app deployed to AWS Lambda via zappa. Zappa creates an AWS rest endpoint such as random_api_ID.execute-api.us-east-2.amazonaws.com/dev
which works perfectly when directly entered into the browser. But, when I use Cloudfront to associate this end point to my custom domain, dev.mywebsite.com
, I get a 404 error in the response for any assets stored in a subfolder. The reason is because Cloudfront is serving urls such as
dev.mywebsite.com/dev/static/css/style.css
instead of
dev.mywebsite.com/static/css/style.css
Also, this works: random_api_ID.execute-api.us-east-2.amazonaws.com/dev/static/css/style.css
But this does not: random_api_ID.execute-api.us-east-2.amazonaws.com/static/css/style.css
So, somehow, I need Cloudfront to associate random_api_ID.execute-api.us-east-2.amazonaws.com/dev
with dev.mywebsite.com
instead of dev.mywebsite.com/dev
.
My Cloudfront distribution has the following parameters:
...ANSWER
Answered 2021-Oct-10 at 05:36There is an option that you are able to add your stageName
to make your URL to be accessible without it.
Go to your CloudFront's Distribution, edit your Origin
which points to API Gateway URL.
- Find the
Origin path
option - Place your
stageName
into it (my example isdev
stage) so it should be/dev
(need to have/
at prefix)
Then click Save changes and wait for the deployment around 5 minutes. And try to access it as you would love to
QUESTION
Working to update an AWS Lambda function that relies on Flask / zappa that was originally written by another programmer. If Python modules are not imported / used by the scripts that are running in Lambda, can I remove them without any problem from requirements.txt
?
The example file provided by AWS seems to have very few requirements. I just want to make sure that Cloudwatch continues to work and I'm not deleting things that AWS depends on implicitly.
Some of the packages that I am considering removing (since not imported by the Python scripts) include:
durationpy
pyrsistent
placebo
pytz
pycparser
troposphere
boto3
i.e. removing pyarrow
and scikit-learn
cut the redeploy time down from 3 minutes to 2 minutes. AWS Lambda also uses less RAM over shorter duration to execute.
ANSWER
Answered 2021-Sep-17 at 01:28It's hard to say as the dependencies vary across applications.
As far as I know, scikit-learn
is a huge library and is not used by AWS. However, if your application or another package in your application uses it as a dependency, removing it might break your application.
Similarly pyarrow
is also used by many packages. Some of the packages of your application could be using it internally.
I'm not sure but boto3
can also be removed as it's always available by default by AWS. But you might want to keep it since you'll be needing it for running the application locally.
For all other packages, I suggest you create a dependency tree of your packages using pipdeptree This will serve as starting point to determine which can could be removed.
QUESTION
I want to use AWS API Gateway HTTP API instead of old REST with my lambda functions, for pricing reasons.
Difference here: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html
What is the option in Zappa for this?
...ANSWER
Answered 2021-Sep-07 at 12:57As of Sept 2021, there is no support for HTTP API Gateways. There is an issue created to add support here: https://github.com/zappa/Zappa/issues/851
QUESTION
My Django REST API is composed of multiples apps, one app per resource like that:
...ANSWER
Answered 2021-Aug-08 at 19:03I suggest you add a stage per app in your zappa_settings.json
file. Then you can deploy each stage independently.
See the documentation for exact formatting.
QUESTION
When installing the Pipfile i'm getting the error 'ERROR: Could not find a version that matches werkzeug<1.0,>=2.0'
There are incompatible versions in the resolved dependencies: werkzeug<1.0 (from zappa==0.51.0) werkzeug>=2.0 (from flask==2.0.1)
MY Pipfile contains (among other stuff):
...ANSWER
Answered 2021-Jul-15 at 11:51your zappa version is 0.51.0 which was released on March 2020 and your flask version is 2.0.1 which was released on May 2021 and their sub dependencies are different. I fixed the issue by downgrading the flask version by specifying version 1.1.4 in pipfile. flask = "==1.1.4"
QUESTION
Since a few days ago, zappa deploy
fails with the following error (zappa version 0.50.0):
ANSWER
Answered 2021-Jul-15 at 09:53Since version 3.0.0
, the package troposphere
removed the deprecated Template
methods (see the changelog).
Breaking changes: * Python 3.6+ (Python 2.x and earlier Python 3.x support is now deprecated due to Python EOL) * Remove previously deprecated Template methods.
The above issue can be fixed by adding troposphere<3
in the requirements file.
QUESTION
I am trying to find a way to integrate our company's Django Web app into Zappa so we can go completely serverless with our REST API. The problem is that our app has existed for several years, making it a lot heavier than the brand new apps that all of these Zappa tutorials init over. Is there a format that Zappa requires for integrating an old Django app into its framework? I have no wait of knowing how much refactoring will be required for Zappa to know how to transition our API into lambda functions. When I tried running Zappa deploy in our root directory, I got the following error, which probably means our app is poorly optimized for the Zappa system:
...ANSWER
Answered 2021-Jun-27 at 21:06One of the primary uses of Zappa is to allow the migration of an existing Django project into AWS Lambda. So moving your REST API to be serverless is an excellent use case for Zappa. In addition, Zappa generally is compatible with older versions of Django.
The issue you are encountering is that AWS Lambda functions must be under 50MB compressed and 250MB uncompressed.
Zappa offers a workaround using the slim_handler
option that allows your project to approach 512MB uncompressed.
To determine how much disk space your current project requires uncompressed, you may run the following Zappa command:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Zappa
You can use Zappa like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page