Amazon RDS
Amazon Relational Database Service (RDS) is a managed SQL database service provided by Amazon Web Services (AWS). Amazon RDS supports an array of database engines to store and organize data. It also helps in relational database management tasks like data migration, backup, recovery and patching.
Amazon RDS facilitates the deployment and maintenance of relational databases in the cloud. Cloud administrators use Amazon RDS to set up, operate, manage, and scale relational instances of cloud databases. Amazon RDS itself is not a database; It is a service used to manage relational databases.
What are the benefits and drawbacks of Amazon RDS?
There are several pros and cons to using Amazon RDS.
Easy to administer: Amazon RDS makes it easy to go from project conception to deployment. Use the Amazon RDS Management Console, the AWS RDS Command-Line Interface, or simple API calls to access the capabilities of a production-ready relational database in minutes. No need for infrastructure provisioning and no need for installing and maintaining database software.
Highly scalable: You can scale your database's compute and storage resources with only a few mouse clicks or an API call, often with no downtime. Many Amazon RDS engine types allow you to launch one or more Read Replicas to offload read traffic from your primary database instance.
Available and durable: Amazon RDS runs on the same highly reliable infrastructure used by other Amazon Web Services. When you provision a Multi-AZ DB Instance, Amazon RDS synchronously replicates the data to a standby instance in a different Availability Zone (AZ). Amazon RDS has many other features that enhance reliability for critical production databases, including automated backups, database snapshots, and automatic host replacement.
Fast: Amazon RDS supports the most demanding database applications. You can choose between two SSD-backed storage options: one optimized for high-performance OLTP applications and the other for cost-effective general-purpose use. In addition, Amazon Aurora provides performance on par with commercial databases at 1/10th the cost.
Secure: Amazon RDS makes it easy to control network access to your database. Amazon RDS also lets you run your database instances in Amazon Virtual Private Cloud (Amazon VPC), enabling you to isolate your database instances and connect to your existing IT infrastructure through an industry-standard encrypted IPsec VPN. Many Amazon RDS engine types offer encryption at rest and encryption in transit.
Inexpensive: You pay very low rates and only for the resources you consume. In addition, you benefit from the option of On-Demand pricing with no up-front or long-term commitments or even lower hourly rates via our Reserved Instance pricing.
Ease of use. Admins don't need to learn specific database management tools, and they also can manage multiple database instances using the management console. RDS is compatible with database engines that users may already be familiar with, such as MySQL and Oracle, and it automates manual backup and recovery processes.
Cost-effectiveness. According to AWS, customers only pay for what they use. Also, the time spent maintaining instances is reduced because maintenance tasks, such as backups and patching are automated.
Drawbacks
Some downsides of using Amazon RDS include the following:
Lack of root access. Because it is a managed service, users do not have root access to the server running RDS. RDS restricts access for certain procedures to those with advanced privileges.
Downtime. Systems must go offline for some patching and scaling procedures, and the timing of these processes varies. With scaling, compute resources need a few minutes of downtime on average.
Amazon RDS database engines
An AWS customer can spin up to six types of database engines within Amazon RDS:
Amazon Aurora is a proprietary AWS relational database engine. Amazon Aurora is compatible with MySQL and PostgreSQL.
RDS for MariaDBis compatible with Maria DB, an open-source relational database management system (RDBMS) that's an offshoot of MySQL.
RDS for MySQL is compatible with the MySQL open-source RDBMS.
RDS for Oracle Databaseis compatible with several editions of Oracle Database, including bring-your-own-license and license-included versions.
RDS for PostgreSQL is compatible with PostgreSQL open-source object-RDBMS.
RDS for SQL Serveris compatible with Microsoft SQL Server, an RDBMS.
Amazon RDS adds support for major and minor versions of database engines over time. It is designed to allow admins to specify an engine version when they create a database instance. In most cases, Amazon RDS can support developer code, applications, and tools already in use with existing databases.
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.
Step 1:- First we need to create an EC2 instance and since we are going to use MYSQL so we need to allow port 3306
Step 2:- No we need to create a Free tier RDS instance of MySQL. We need to search Amazon RDS-> Create database.
Then In Enginee options need to choose MySQL
need to Choose the "Free tier" template
Now we need to select the name
Need to Set the "Master username" and "Master password" for the database
Instance Configuration and Storage need to select
Select the Connectivity, compute resource as EC2 compute resource
Now we need to select VPC security group and click on Create database
Once it will create it will show like the below screenshot
Step 3:- Now we need to Create an IAM role with RDS access
Now we need to go IAM service and click on roles and need to choose AWS service -> select EC2 and click on next
now we can select AmazonRDSFullAccess and click on next
after creating create a role it will look like below screenshot
Step 4:- Now we need to Assign the role to EC2 so that your EC2 Instance can connect with RDS
Need to click on Actions->Security->Modify IAM role ->
select IAM which we created and click on update IAM role
Step 5:- Once the RDS instance is up and running, get the credentials and connect your EC2 instance using a MySQL client.
Now we need to go inside the EC2 machine and need to install the mysql client by following the below command
sudo apt install mysql-client-core-8.0
Once installed completed we can check MySQL is installed or not by running the below command
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
# Ex:- mysql -h my-rds-sql.ctsxxmdfwhqv.us-east-1.rds.amazonaws.com -P 3306 -u admin -p
After giving the password it will be like this
Thank you for reading!! I hope you find this article helpful!!
if any queries or corrections to be done to this blog please let me know.
Happy Learning!!
Saikat Mukherjee