This project is a Django-based web application for booking and managing AWS EC2 instances. It allows users to register for bookings, automatically creates user credentials, provisions EC2 instances, and sends email notifications with instance details.
- User registration for booking EC2 instances
- Automatic creation of user credentials
- Provisioning of EC2 instances with JupyterHub
- Email notifications with booking and instance details
- Scheduled shutdown of EC2 instances
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Set up environment variables in a .env file:
SECRET_KEY=your_secret_key DEBUG=True ALLOWED_HOSTS=localhost,127.0.0.1 DB_NAME=your_db_name DB_USER=your_db_user DB_PASSWORD=your_db_password DB_HOST=your_db_host DB_PORT=5432 TIME_ZONE=your_time_zone AWS_ACCESS_KEY_ID=your_aws_access_key_id AWS_SECRET_ACCESS_KEY=your_aws_secret_access_key AWS_DEFAULT_REGION=your_aws_default_region
-
Run database migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
- Access the application at
http://localhost:8000/booking/register/
to register for a booking. - Admin interface is available at
http://localhost:8000/admin/
.
To run the application using Docker:
-
Build and start the containers:
docker-compose up --build
-
Access the application at
http://localhost:8001/booking/register/
.
To run tests:
python manage.py test