This project automates the deployment of a distributed MySQL Cluster on AWS EC2. It implements the Proxy pattern for load balancing (Read/Write splitting) and the Gatekeeper pattern for security.
The automation script provisions 5 EC2 instances (t3.micro):
- Manager: MySQL Master (Write operations).
- Worker 1 & 2: MySQL Slaves (Read operations).
- Proxy: Routes traffic (Trusted Host).
- Gatekeeper: Public entry point (Security validator).
- Python 3.8+ installed.
- AWS Account with appropriate permissions (EC2, Security Groups).
- AWS Credentials configured locally (via
aws configureor~/.aws/credentials). - A key pair created in AWS named
test.
- Clone the repository or download the source code.
- Place your AWS private key file (
test.pem) in the same directory as the script. - Install dependencies:
pip install -r requirements.txt
Open main.py and verify the configuration constants at the top of the file:
KEY_NAME = 'test' # Must match your AWS Key Pair name
KEY_PATH = './test.pem' # Path to your local .pem file
REGION = 'us-east-1' # Desired AWS Region