- Newest
- Most votes
- Most comments
To deploy your Flask app on AWS Lambda and integrate it with Wix.com as a frontend, you can follow these steps:
-
Prepare your Flask application:
- Ensure your app.py file contains all the necessary Flask routes and logic.
- Make sure your requirements.txt file includes all the required dependencies, including Flask and instaloader.
-
Set up AWS Lambda:
- Create a new Lambda function in the AWS Console.
- Choose Python as the runtime environment (use the version that matches your local development environment).
-
Package your application:
- Create a deployment package that includes your app.py, the session folder, and any other necessary files.
- Install the required dependencies in a separate directory and include them in your package.
-
Configure environment variables:
- In the Lambda function configuration, set up environment variables for your .env file contents (insta_username, password, and the two proxy variables).
-
Use AWS API Gateway:
- Create a new API in API Gateway.
- Set up routes that correspond to your Flask app's endpoints.
- Connect these routes to your Lambda function.
-
Deploy your application:
- Upload your deployment package to the Lambda function.
- Deploy your API Gateway configuration.
-
Integrate with Wix:
- Use the API Gateway endpoint URL in your Wix frontend to make requests to your Flask app.
Regarding the Zappa deployment issue, internal server error 500 usually indicates a problem with the application code or configuration. You might want to check your Zappa settings, ensure all dependencies are correctly specified, and review your Lambda function logs for more detailed error information.
For additional guidance, you can refer to AWS documentation on deploying Flask applications to Lambda, or consider using the AWS Serverless Application Model (SAM) for a more streamlined deployment process. Remember to handle CORS (Cross-Origin Resource Sharing) if your Wix frontend will be making requests from a different domain.
Sources
flask python app using sqlalchemy | AWS re:Post
Instrumenting web frameworks deployed to serverless environments - AWS X-Ray
by using the Lambda Web Adapter, which serves as a universal adapter for Lambda Runtime API and HTTP API. It allows developers to package familiar HTTP 1.1/1.0 web applications, such as Express.js, Next.js, Flask, SpringBoot, or Laravel, and deploy them on AWS Lambda. This replaces the need to modify the web application to accommodate Lambda’s input and output formats, reducing the complexity of adapting code to meet Lambda’s requirements.
You can use this sample project to get started, and this blog to follow along
answered 2 years ago
Hi,
You may want to follow the guidance of this article to run Flask in Lambda: https://www.cloudtechsimplified.com/run-python-flask-in-aws-lambda/
Also, this video is interesting: https://www.youtube.com/watch?v=snDW-5n01ak
Best,
Didier
Relevant content
asked 4 years ago
asked 2 years ago
- AWS OFFICIALUpdated 5 years ago

Thanks for answering! How do i handle sessions? I wanted to store sessions in s3 and whenever required with post method lambda will retrieve that session info.