Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RDS Cluster and DB Instance concept

I need to create the RDS Aurora 5.7 database. I think I am not clear on the RDS concept. Is this the correct hierarchy? aws_rds_cluster -> aws_rds_cluster_instance -> aws_db_instance I should need to define all of the above since I kinda stuck on the configuration so I try to clarify the concept

like image 976
Jack Avatar asked Apr 04 '18 03:04

Jack


People also ask

What is the difference between RDS cluster and instance?

Database Cluster is the name of the cluster that holds the instances. Database Instances are the names of each instance in the cluster.

What is DB cluster AWS RDS?

An Amazon Aurora DB cluster consists of one or more DB instances and a cluster volume that manages the data for those DB instances. An Aurora cluster volume is a virtual database storage volume that spans multiple Availability Zones, with each Availability Zone having a copy of the DB cluster data.

What is the difference between cluster and instance?

Instances have one or more clusters, located in different zones. Each cluster has at least 1 node. A table belongs to an instance, not to a cluster or node. If you have an instance with more than one cluster, you are using replication.

What is an RDS instance?

An Amazon RDS instance is a cloud database environment. Admins can also spin up many databases or schemas; how many depends on the database used. Amazon RDS limits each customer to a total of 40 database instances per account. AWS imposes further limitations for Oracle and SQL Server instances.


1 Answers

A "classic" RDS instance is defined in Terraform as an aws_db_instance. This is either single-AZ or multi-AZ, but it defines the entire cluster and the instances that comprise the cluster. Since you want Aurora, this is not what you want based on your question.

You want an aws_rds_cluster which defines the entire cluster, then at least one aws_rds_cluster_instance which defines instances. The aws_rds_cluster_instance then defines which cluster it is a part of with the cluster_identifier argument.

Clusters provide the storage backend where your live data and automated backups reside. The global parameter group (parameters that must be the same among all instances using that storage backend) are set at this level as well.`

Instances are servers running a copy of MySQL with access to the storage backend. They have instance parameter groups which define parameters that are ok to be different between instances. Right now you can only have 1 writer instance per cluster plus multiple reader instances, although Amazon is working on multi-master which would allow multiple writer instances.

You can add/remove instances at will, but once you delete the cluster itself your storage (and all automatic snapshots!) go away. Take manual snapshots to keep copies of your data that will not disappear if the cluster is deleted.

like image 198
Eric M. Johnson Avatar answered Oct 12 '22 09:10

Eric M. Johnson