- Now of course there are plenty of times,
plenty of environments, such as production,
when you need a high degree of durability
in your data that you need not only backups,
but also, maybe even, multiple copies of the data live
and ready to go, so that in case one is unavailable,
you can switch to another.
So we have several options within RDS to help us with that.
The first option would be Multi-AZ Deployments.
With Multi-AZ Deployments, as you can see here,
we would choose, of course we would choose, a region.
In this example we're using the Oregon region
in us-west-2.
And for Multi-AZ Deployment, we need to choose,
or we need to enable,
RDS to leverage multiple availability zones.
Right?
So we are creating a VPC and creating subnets
that allow us to use these two different
availability zones.
Both us in this example, us-west-2b and 2c.
And of course, you can see here, in order to do that,
we've created two different subnets.
Right, each with their own range.
And the benefit of Multi-AZ Deployments is that we get
not only a primary, not just one instance,
we also get a stand-by instance,
and of course AWS creates and manages
both of those instances.
And then AWS also manages the ongoing
synchronous replication between them.
Right?
So you can see here with Multi-AZ Deployments,
we have multiple copies of the data that's live,
that we can switch from one to the other very quickly,
and very easily.
And so, again with Multi-AZ Deployments,
we gain access to not just high availability,
but also fault tolerance.
There is some built in fault tolerance,
so that if the primary fails,
we can switch over automatically,
or failover to that secondary.
And of course, that is, Amazon handles the synchronous
replication between those two,
and those are built and not only on physically distinct
servers, but also in physically distinct data centers.
Remember, we just talked
about the two different availability zones
and we know that those different availability zones
are physically distinct centers.
And so, automatic failover can take place if there's
a loss of a network.
Right, so, if the primary is unreachable due to some issue
with the network,
if the primary is unreachable
because there was an underlying compute failure
or an underlying storage failure,
then AWS will automatically promote
the secondary to primary,
switch us over and then automatically replace
the failed primary, which then becomes
the new secondary.
And then of course, this is considered
a production best practice.
So if you are running production workloads on RDS,
Amazon does recommend that you opt
into a Multi-AZ Deployment.
Remember that that is not the default.
If you need that secondary instance live,
if you need the ability to automatically failover,
you, it is up to you,
to choose a Multi-AZ Deployment.
Now another option that we have in order to help us
with data durability are backups.
And of course RDS performs these backups automatically,
and we know that because RDS is essentially built on top
of EC2 and EBS that those Snapshots will go to S3.
And we know that S3 is inherently replicated across
numerous availability zones.
Right, so there is an even higher degree of durability
when the data is stored in S3.
And so, we get to choose the window of time,
when does the backup happen.
Right?
Perhaps when you have the lowest amount of traffic
or the lowest amount of work being done
by the database.
Right?
Who knows, that could be 1:00 a.m., 5:00 a.m.,
whenever that window is for you,
you get to determine when that backup
actually happens.
And that is performed, the automated backups,
are performed once per day.
And, like I said, those are essentially the same thing
as an EBS Snapshot.
Right?
They're taken from the volume and written to S3,
and those automated backups are retained for up to 35 days,
so you do get a pretty decent period of time
to which you can roll back.
You can easily restore an entire database
from a backup.
We can also perform a point-in-time restore,
up to a five minute window.
And you can also copy those backups to another region,
so if you wanted to gain an even greater degree
of durability, to have, you know, if you wanted
to have two copies of the data live
with Multi-AZ Deployments, you have backups
in that same region,
and then to take it a step further,
by copying those backups to another region,
now you have yet another, not just one copy,
but ultimately, because again, because it's NS3,
you have multiple copies in that other region,
thousands of miles apart.
So if there is some kind of a disaster,
you know that that data is still available
in another region.
So, we have between Multi-AZ Deployments
and automated backups, we have plenty of tools
that make it very easy for us to ensure
a very high degree of durability in our data with RDS.