This project demonstrates the use of AWS RDS in a sample application. Note: This project is for demo purposes only.
Follow the steps below to set up the project:
-
Ensure you have the following installed:
- Python (v3.8 or later)
- AWS CLI (configured with appropriate credentials)
-
Clone the repository:
git clone <repository-url> cd rds-sample-project
-
Search for AWS RDS on the AWS Console
You can either use the search bar on the top or select from the Database services in the services tab and select AWS RDS. -
Create a Database Instance
Select the database engine you want to use, such as MySQL, PostgreSQL, or Amazon Aurora. For this practical, we'll be using the default MySQL DB. -
Configure Instance
Specify the instance type, storage, and other configuration options based on your requirements. For this example, we'll be using the default template (Free tier), user (admin
), password, and make sure that you give an identifier and database name; otherwise, RDS will not create a database. -
Secure and Connect
Configure security options, such as VPC and firewall rules, and connect to your RDS instance. For this example, we'll give our database public access to the application interface. Also, make sure that you have added the MySQL/Aurora security rule to the security group for connectivity. -
Database Connectivity
For connectivity to the database, you need to create a connection string that consists of the database endpoint (host), name of the database, user, and password (master password).
Run the following command to install the required dependencies:
pip install -r requirements.txt
Create a .env
file in the root directory and add the necessary environment variables:
DB_HOST=<your-rds-endpoint>
DB_USER=<your-database-username>
DB_PASSWORD=<your-database-password>
DB_NAME=<your-database-name>
Start the application using the following command:
python app.py
- This project is intended for demonstration purposes only and should not be used in production environments.
- Ensure your AWS credentials and RDS configurations are secure and not exposed in public repositories.