This guide explains how to prepare an AWS environment for hosting City School using an Amazon EC2 server for the application and Amazon RDS for MySQL for the database.
The recommended architecture is:
Domain → EC2 → City School application → RDS MySQL
Prerequisites
Before starting, you need:
- An AWS account
- A domain name
- An SSH key pair
- Basic Linux and SSH knowledge
- Access to the AWS Console
Step 1 — Create an EC2 Instance
Sign in to the AWS Management Console and open EC2.
Choose Launch instance and give the server a name such as:
cityschool-production
Under Application and OS Images, select an Ubuntu LTS release, such as Ubuntu Server 24.04 LTS.
Choose an EC2 instance size appropriate for your expected workload. A small installation can start with approximately 2 vCPUs and 2–4 GB of RAM and be scaled later if necessary.
Step 2 — Configure SSH Access
Under Key pair, select an existing SSH key or create a new one.
Download the private key and store it securely.
On Linux or macOS, set the key permissions:
chmod 400 cityschool-key.pem
Never upload the private key to the server or place it inside the City School application directory.
Step 3 — Configure the EC2 Security Group
Create a security group for the application server.
Allow:
- SSH — port
22, from your trusted IP address - HTTP — port
80 - HTTPS — port
443
Do not open database port 3306 to the internet.
Step 4 — Launch the EC2 Instance
Review the configuration and choose Launch instance.
After AWS creates the instance, copy its public IPv4 address.
Connect to Ubuntu using:
ssh -i cityschool-key.pem ubuntu@YOUR_EC2_PUBLIC_IP
Then update the server:
sudo apt update
sudo apt upgrade -y
Create the Amazon RDS Database
Step 5 — Open Amazon RDS
In the AWS Console, open RDS and choose Create database.
Select:
MySQL
Choose a MySQL version supported by your City School release.
Step 6 — Configure the RDS Database
Enter a database identifier such as:
cityschool-production-db
Create a strong master username and password.
For example:
cityschooladmin
Store the password securely.
Step 7 — Configure the RDS Network
Place RDS in the same VPC as your EC2 instance.
For production, configure the database in private subnets where appropriate.
Disable public access so the database is not directly reachable from the internet.
Step 8 — Configure the RDS Security Group
Create a dedicated security group for RDS.
Allow MySQL traffic on port:
3306
Set the source to the EC2 security group, not 0.0.0.0/0.
The network should look like:
Internet
|
v
EC2 / City School
|
| Private AWS network
v
RDS MySQL
Step 9 — Enable RDS Backups
Enable automated backups and select an appropriate retention period.
For a production City School installation, regular database backups are essential.
Step 10 — Create the RDS Database
Choose Create database and wait until the RDS instance becomes available.
Open the database details and copy the RDS endpoint.
It will look similar to:
cityschool-production-db.xxxxxxxxxxxx.eu-west-1.rds.amazonaws.com
Use this endpoint as the database host.
Test the EC2 to RDS Connection
Step 11 — Install the MySQL Client
On the Ubuntu EC2 server:
sudo apt install mysql-client -y
Step 12 — Test the Connection
Run:
mysql -h YOUR_RDS_ENDPOINT -u cityschooladmin -p
Enter the RDS password when prompted.
If the connection succeeds, the EC2 server can communicate with the RDS database.
Step 13 — Create the City School Database
Create the application database:
CREATE DATABASE cityschool;
Then verify it:
SHOW DATABASES;
Use the database creation procedure provided by your City School release if it differs from this example.
City School Database Configuration
The City School environment configuration will use values similar to:
DB_CONNECTION=mysql
DB_HOST=YOUR_RDS_ENDPOINT
DB_PORT=3306
DB_DATABASE=cityschool
DB_USERNAME=cityschooladmin
DB_PASSWORD=YOUR_RDS_PASSWORD
Keep these credentials private. Do not commit them to Git or publish them in your application files.