RDS Sharding & Quick Commands

Here unlike ec2 instances there is no rds-db-instance-id instead we use the db-instance names (called as dbinstance_identifiers) in our rds commmands to identify among rds-db-instances.

Example-
Database Name – news
RDS DB Instances – shard1, shard2

Consider creating 2 db-shards ie we need 2 db-instance to map those db-shards to db-instances. To reduce the schema setup overhead we use the snapshot and restore capabilities of Amazon RDS to do the following:

1. Create a single “seed” DB Instance.
2. Set up the schema on that database.
3. Snapshot the database.
4. Create more databases from that snapshot using the RDS RestoreDBInstanceFromSnapshot API.

Once the snapshot is available it can be used to create any number of DB Instances. We’re only creating two DB Instances in this example, but it could easily be many more. Also, for our trivial setup, the only efficiency we gain is that we don’t need to create the schema on each. However, in a typical scenario there might be a lot more setup involved in creating the seed (e.g., application configuration data, user accounts, permissions, etc.).

4.DB-INSTANCE FROM DB-SNAPSHOT

The following command can be used to create new DB Instances from the seed snapshot: