Welcome to the Aurora Database Project! This comprehensive guide is designed to help you create and connect an Aurora MySQL database to an EC2 instance step-by-step. π
Welcome to the Aurora Database Project! This comprehensive guide is designed to help you create and connect an Aurora MySQL database to an EC2 instance step-by-step. π
To get started, log in as your IAM user, not your root user.
Open the AWS Console.
Log in using your IAM Admin User credentials.
If you donβt have an IAM user, create one:
π‘ Why IAM Users? IAM users enable secure access to AWS services without exposing the root account.
Locate the region dropdown at the top-right corner of the AWS Console.
Ensure all resources (RDS, EC2, etc.) are created in the same region.
π‘ Tip: Choose the closest region to your location for lower latency.
Open the RDS Console (search for βRDSβ in the AWS search bar).
Click Databases > Create Database.
Configure your database:
Engine type: Aurora (MySQL-Compatible)
Engine version: Aurora MySQL 3.05.2 (compatible with MySQL 8.0.32).
Template: Development/Test
DB Cluster Identifier: aurora-cluster
Master Username: admin
Master Password: Strong password (e.g., P@ssw0rd123
)
Instance Class: db.t3.medium
Enable Storage Autoscaling for flexibility.
Ensure the VPC and Subnet Group match your EC2 instance.
Leave other settings as default and click Create Database.
π¨ Note: Auroraβs storage scales automatically, but charges may increase with usage. Monitor your RDS usage in the AWS Billing Console.
Open the EC2 Console.
Click Launch Instance and configure the following:
Name: web-server
AMI: Amazon Linux 2023 AMI (or any supported Linux OS).
Instance Type: t2.micro
(Free Tier eligible).
Key Pair: Create a new key pair and download the .pem
file for SSH access.
Networking:
Ensure the EC2 instance is launched in the same VPC as your Aurora database.
Attach a security group with:
Inbound Rules:
SSH (port 22): Allow your IP.
MySQL/Aurora (port 3306): Allow traffic from the EC2 instance.
HTTP/HTTPS (ports 80/443): Allow public traffic (optional).
Click Launch Instance.
π‘ Tip: Use the chmod 400 keyfile.pem
command to secure your private key before SSH access.
Replace <Aurora-Endpoint>
with your RDS endpoint from the AWS Console.
π¨ Common Issues:
Ensure the Aurora security group allows traffic from the EC2 instance.
Verify that the endpoint and credentials are correct.
Develop a web application that connects to your Aurora database.
Deploy your web app and test database interactions.
To avoid unnecessary costs, delete unused resources:
Delete the RDS Cluster: Go to the RDS Console, select your database, and choose Delete.
Terminate the EC2 Instance: Navigate to the EC2 Console, select the instance, and click Terminate.
π¨ Warning: Ensure you have backups of any important data before deleting resources.
Good luck and happy coding! π
For questions or feedback, reach out:
π¨ Email: projects@briankimemia.is-a.dev π Portfolio: Brian Kimemia GitHub: BrianKN019
Thank you for exploring this project! Letβs innovate and build secure AWS solutions together. π