Skip to content

This project uses Terraform to deploy a Flask application to AWS Elastic Beanstalk

Notifications You must be signed in to change notification settings

AntonAks/AWS-ElasticBeanstalk-Flask-Vue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deploying Flask App on AWS Elastic Beanstalk with Terraform

Overview

This project uses Terraform to deploy a Flask application to AWS Elastic Beanstalk. It provisions the necessary infrastructure, including:

VPC, Subnet, Internet Gateway
Security Group for Beanstalk
S3 Bucket for Flask app ZIP
IAM Role & Instance Profile for Beanstalk
Elastic Beanstalk Application & Environment
Application Version linked to S3 ZIP

Architecture

  • A Flask app is packaged into a .zip file and uploaded to an S3 bucket.
  • Terraform provisions an Elastic Beanstalk environment to deploy the Flask app.
  • The app is accessible via an auto-generated AWS Beanstalk URL.

Prerequisites

Ensure you have the following installed:

  • Terraform
  • AWS CLI (configured with credentials)
  • Python 3+
  • Flask (if you want to test locally)

Setup & Deployment

1️⃣ Clone the Repository

2️⃣ Package the Flask App

Ensure flask-app.zip is present in your working directory:

zip -r flask-app.zip .ebextensions/ static/ requirements.txt application.py

3️⃣ Initialize Terraform

terraform init

4️⃣ Apply Terraform Configuration

This will provision AWS resources and deploy the Flask app:

terraform apply -auto-approve

5️⃣ Get the Beanstalk URL

Once deployment is complete, navigate to AWS Console → Elastic Beanstalk → flask-app-env and find the Application URL.

6️⃣ Visit the App 🎉

Open your browser and go to:

http://<your-beanstalk-url>

Cleanup

To remove all resources:

terraform destroy -auto-approve

⚠️ This permanently deletes all AWS resources.

Files Structure

├── main.tf            # Terraform configuration
├── flask-app.zip      # Flask app archive (uploaded to S3)
├── app.py             # Flask application
├── static/
│   └── index.html     # Vue.js frontend
├── .ebextensions/
│   └── python.config  # Elastic Beanstalk configuration
├── README.md          # Documentation (this file)
├── requirements.txt   # required modules

Author

💡 Created by Anton Aks - Feel free to contribute and improve!


Happy coding! 🚀

About

This project uses Terraform to deploy a Flask application to AWS Elastic Beanstalk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published