DAY44: Relational Database Service in AWS
Amazon RDS (Relational Database Service) is a fully managed database service provided by Amazon Web Services (AWS). It simplifies the administration and operation of relational databases, allowing you to focus on your applications rather than managing the underlying infrastructure.
With Amazon RDS, you can set up, operate, and scale a relational database in the cloud easily. It supports popular database engines such as Amazon Aurora, MySQL, PostgreSQL, MariaDB, Oracle Database, and Microsoft SQL Server.
How Amazon RDS Works?
Traditionally, database management used to be a very scattered service, from the webserver to the application server and then finally to the database. For the maintenance of such a vast system a team was required, to shrink this workforce, AWS came across an amazing all-in-one service, RDS. The whole architecture of RDS includes every aspect of the traditional management system, all in place. Thus, it includes everything from EC2 (Elastic Compute Cloud) to DNS (Domain Name System). Every part of the RDS architecture has its own separate set of features completely different from each other. A diagrammatical representation of RDS has been attached ahead.
Key features of Amazon RDS:
Managed Service:
✔Amazon RDS is a fully managed service, meaning that AWS takes care of the underlying infrastructure, including hardware provisioning, database setup, software patching, regular backups, and automated software updates.
✔This allows you to offload the operational tasks associated with managing a database, reducing administrative overhead and allowing you to focus on your applications.
Easy Deployment:
✔With Amazon RDS, you can easily deploy a relational database instance in minutes. You can choose the database engine, specify the instance size, and configure parameters such as storage, backups, and security settings using the AWS Management Console, CLI, or SDKs.
Scalability:
✔Amazon RDS makes it easy to scale your database as your application's needs grow. You can vertically scale your database instance by changing the instance size to handle increased workload or storage requirements.
✔Additionally, you can horizontally scale read-heavy workloads by creating Read Replicas, which are copies of your database instance that can handle read traffic and offload the primary instance.
High Availability and Durability:
✔Amazon RDS provides built-in high availability and data durability. It automatically performs backups and allows you to enable automated snapshots, which can be used for point-in-time recovery.
✔Amazon RDS also offers Multi-AZ deployments, where it synchronously replicates your database across multiple availability zones to provide automatic failover in the event of a hardware or availability zone failure.
Security:
✔Amazon RDS offers robust security features to protect your databases. It provides network isolation through Amazon Virtual Private Cloud (VPC), encryption at rest using AWS Key Management Service (KMS), encryption in transit using SSL/TLS, and integration with AWS Identity and Access Management (IAM) for fine-grained access control.
Monitoring and Metrics:
🔑Amazon RDS provides detailed monitoring and metrics to help you understand the performance and health of your databases. You can monitor CPU usage, storage, I/O activity, and other database-specific metrics using Amazon CloudWatch.
🔑This allows you to set alarms, troubleshoot performance issues, and optimize your database configuration.
AWS RDS Database Engines
There are six database engines which RDS provides, and they are:
Amazon Aurora
PostgreSQL
MySQL
MariaDB
Oracle Database
Microsoft SQL Server
Benefits of Amazon RDS:
Task-1
Create a Free tier RDS instance of MySQL
Go to the Amazon RDS console. Click "Create database".
Select Version of PostgreSQL and select template to create a database.
In settings, give the name of your database, username, and password to access the application.
Set the "Virtual Private Cloud (VPC)" and "Subnet group" to create the instance.
Choose the VPC security group
Click "Create Database" to start the instance creation.
The database is created.
Create an EC2 instance
Go to the Amazon EC2 console.
Click "Launch Instance". Choose a Linux AMI.
Choose an instance type, such as t2.micro. Choose a VPC and subnet.
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 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 on "Create role".
Assign the role to EC2 so that your EC2 Instance can connect with RDS
Go to the EC2 console and Select the instance you just created.
Click "Actions", then "Security", then "Modify IAM Role".
Choose the IAM role you just created and 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 and Click "Connectivity and Security" and note the endpoint address.
Click "Configuration" 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" using the command.
sudo apt install mysql-client-core-8.0
Connect to the RDS instance using the MySQL client and the endpoint address, username, and password:
mysql -h <endpoint address> -P <port.no> -u <username> -p mysql -h database-1.cyzxd1zu9ohs.us-east-1.rds.amazonaws.com -P 3360 -u admin -p
You should now be connected to the MySQL database on the RDS instance.
Thank you for 📖reading my blog, 👍Like it and share it 🔄 with your friends.
Happy learning😊😊
Subscribe to my newsletter
Read articles from Siri Chandana directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by