AWS RDS Key Concepts & Why you should use it?
With any software's/application's most important part is how we are managing data and specially for production environment, how my database is highly available, resilience and scalable. So that you are not losing any data, your database is well optimized to handle expected traffic/load and able to recover point in time data recovery.
We can use self managed database as well instead of AWS RDS, but it could be challenging work for you to manage and have everything in place.
Below are the key concepts of AWS RDS which will help you know, what best we should be able to do with AWS RDS and how it can help us to avoid self management workloads and risks.
- RDS is self AWS managed service, that means, you do not need to manage infrastructure/servers, all will be manged by AWS only. You just need to create your database instance and like your self owned database server, with AWS RDS it will give you endpoint i.e. DB connection string basis which you can simply connect to your database same like your self owned database.
- AWS RDS provide you multi AZ deployment option which help you to keep your database highly available. So this will give your two instance primary and stand by in different availability zone, where in case of any failure at primary, stand by automatically will become primary. So that means your database always remain up without any downtime.
Few notes to remember:
- You cannot use stand by instance for read operation(like you want to connect stand by instance for all your reports etc.. instead of primary instance), that means, stand by instance is simply managed by AWS and data remain sync with primary DB and it utilized in case of any failure.
- For read operation if you want to have separate instance, then you can create read replica instance against the primary DB instance. Details you can check with below points.
- But, currently, there is two database "MySQL and Postgresql" both has multi AZ deployment by AWS RDS which support read replica, where actually it create one primary DB instance and two stand by instance and because of having multiple stand by instance, it give you option/end point of stand by instance to use for read operations. But currently this multi AZ deployment only available for "MySQL and Postgresql":
- AWS RDS provide read replica instance which automatically remain sync with primary database instance and this read replica instance you can use for doing all the read operations like you want to run reports, data export or any analytics work, you can use read replica instance, so that it will not put extra/eddition load on your primary database and you can use your primary database for all real time OLTP operations only, so that it will always give you better performance.
You can also create multiple read replica instance, like if you more read operations utilizations then this will help you to distribute your read traffic.
To create read replica, just select your database and from action menu create replica instance.
- AWS RDS provide proxy to connect your database using proxy instead of directly database endpoint and this help with database performance because of :
- This give work inside VPC only, that means, it does not route your connection through internet.
- It provide connection pool, which help to use same connection for same request instead of every time new db connection allocation.
- In case of failover, compare to without proxy connection, with proxy work fast to get stand by instance auto connect as primary.
- So if you have created proxy for your database, then part of your DB connection string, just use the proxy endpoint instead of database endpoint and also, just to note,
- when you create proxy, it ask for secret manager, so first you create one secret manger as RDS auth type and then there put your same database master credential as user id and password what you had created during launch and then use that secret manager while creating proxy.
- AWS RDS provide you automated backup/snapshot and point in time restore/recovery. This help you to take backup of your database as per the frequency you define like daily, hourly etc.. And then same backup you can later use to restore DB due to any DR process or audit.
During restore, you can choose point in time recovery option as well, that means you will be able to restore your DB(as new DB), up to time frame you select for point in time recovery.
You can also set the retention period of backups, so that old database backups automatically will be deleted and it will free your space/cost.
- As the AWS RDS is self AWS managed service, so manage DB server infra maintenance self, where you can specify apply maintenance automatically during specific time or it can provide suggestions and manually you can follow update it.
- It give you proper logs into and matrix which can help you analysis your DB connections, DB server related events like server start/stop and utilizations etc.
- You can enable IAM authentication, which help you to have password less connections from your code base to your RDS database, that means from your code base while making database connection, you do not require to specify database password instead it will work using IAM role, which improve your DB security.
- AWS RDS provide blue/green deployment option - A blue/green deployment copies a production database environment to a separate, synchronized staging environment. By using Amazon RDS Blue/Green Deployments, you can make changes to the database in the staging environment without affecting the production environment. For example, you can upgrade the major or minor DB engine version, change database parameters, or make schema changes in the staging environment. When you are ready, you can promote the staging environment to be the new production database environment, with downtime typically under one minute.
Other Notes:
- If you want to test multi AZ deploy fail over, then you can select your database and from action menu choose reboot option, on next window choose with fail over option.
- If you have keep database shut down to save cost, then that you can be able only do if there is not read replica instance to your database, if replica exists then you cannot be able to shutdown. To make it shutdown, first you need to delete replica.
Categories/Tags: aws rds~rds