Table of contents
Amazon RDS
Amazon RDS (Relational Database Service) is a fully managed database service provided by AWS. It simplifies the deployment, operation, and scaling of relational databases in the cloud.
RDS supports various popular database engines, including Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle Database, and Microsoft SQL Server.
Key features of Amazon RDS
Automated Database Management: RDS handles routine database management tasks such as hardware provisioning, software patching, backups, and automated software updates, allowing users to focus on their applications rather than database administration.
High Availability and Durability: RDS provides built-in features for high availability, such as automated backups, database snapshots, and multi-Availability Zone deployments. These features help ensure data durability and minimize downtime.
Scalability: RDS allows users to easily scale their databases up or down based on workload demands. It provides options for scaling compute and storage resources without impacting application availability.
Security: RDS offers robust security features, including encryption at rest and in transit, network isolation, and integration with AWS Identity and Access Management (IAM) for fine-grained access control.
Monitoring and Performance Insights: RDS provides comprehensive monitoring capabilities, including automated performance monitoring, database metrics, and integration with Amazon CloudWatch for alerts and notifications. It also offers Performance Insights, which helps analyze and troubleshoot database performance.
Read Replicas and Multi-AZ Deployments: RDS supports Read Replicas for offloading read traffic and improving read scalability. It also offers Multi-AZ deployments for high availability and automatic failover.
Database Engine Compatibility: RDS supports various database engines, allowing users to choose the engine that best suits their applications and easily migrate existing databases to RDS.
Task-01
Create a Free tier RDS instance of MySQL
Create an EC2 instance
Create an IAM role with RDS access
Assign the role to EC2 so that your EC2 Instance can connect with RDS
Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.
Create an EC2 instance
Create an EC2 instance and Configure security group rules to allow inbound traffic on the appropriate port for the type of database you are using (e.g. port 3306 for MySQL).
Create a Free tier RDS instance of MySQL
Go to the Amazon RDS console. Click "Create database".
Select "MySQL" as the engine type.
- Choose the "Free tier" template for the "DB instance class".
- Enter a unique name for the "DB instance identifier".
- Set the "Master username" and "Master password" for the database.
- Select the type of DB
- Select the type of storage
- Select the Connectivity, compute resource as EC2 compute resource.
Set the "Virtual Private Cloud (VPC)" and "Subnet group" to create the instance.
Leave the other settings at their default values.
Select ec2-instance, choose VPC security group
Click "Create Database" to start the instance creation.The database is created.
Create an IAM role with RDS access.
- Go to the IAM console. Click "Roles". Click "Create role".
Choose the 'AWS service'.
Choose "Allows EC2 instances to call AWS services on your behalf".
- Attach the "AmazonRDSFullAccess" policy.
- Enter a unique name for the role.
- Click "Create role".
Assign the role to EC2 so that your EC2 Instance can connect with RDS
Go to the EC2 console, Select the instance you just created.
Click "Actions", then "Instance Settings", then "Attach/Replace IAM Role".
Choose the IAM role you just created.
Click "Update IAM role".
Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.
- Go to the RDS console. Select the instance you just created.
- Click "Configuration" and note the endpoint address.
- Click "Security" and note the username and password.
SSH into your EC2 instance using a terminal or remote access tool.
Install a MySQL client, such as "MySQL".
sudo apt install mysql-client-core-8.0
- Now check the mysql version.
mysql --version
Connect to the RDS instance using the MySQL client and the endpoint address, username, and password:
Get the Endpoint & Port from the Connectivity & Security of RDS
mysql -h <endpoint address> -P <port.no> -u <username> -p
# mysql -h mysqldb-1.cr47u4z9w5rk.us-east-1.rds.amazonaws.com -P 3306 -u admin -p
- Enter the password when prompted and press enter.
- You should now be connected to the MySQL database on the RDS instance.
Thank You,
I want to express my deepest gratitude to each and every one of you who has taken the time to read, engage, and support my journey.
Feel free to reach out to me if any corrections or add-ons are required on blogs. Your feedback is always welcome & appreciated.
~ Abhisek Moharana ๐