RDS - Why is a backup created on creation - amazon-web-services

I am working with RDS and I have noticed that when I create the database it seems to create an automated snapshot.
I can understand this when the instance is being shutdown by why is one made when the database is actually created, and is there any way to stop this from happening?

You can set the instance's backup retention period to 0 which will disable backups. However, as far as I know there is no way to create an instance in this state.
RDS uses this snapshot along with the MySQL binary log (or equivalent for other dbs) to provide point in time recovery with 5 minute granularity, as well as restoring the whole snapshot.

This is RDS doing a backup for you. It defaults to every 30 minutes, but it can be increased up to every 3 hours. You are not able to disable this as it is core functionality for RDS's disaster recovery implementation so that the database can be restored to a 30 minute relative point in time whenever necessary.

Related

Does AWS DBInstance maintenance keep data intact

We are using CloudFormation Template to create MySQL AWS::RDS::DBInstance.
My question is when there is maintenance in progress while applying OS upgrades or software/security patches, will
Database Instance be unavailable for the time of maintenance
Does it wipe out data from database instance during maintenance?
If answer to first is yes, will using DBCluster help avoid that short downtime, if I use more than one instances?
From the documentation I did not receive any indication that there is any loss of data possibility.
Database Instance be unavailable for the time of maintenance
They may reboot the server to apply the maintenance. I've personally never seen anything more than a reboot, but I suppose it's possible they may have to shut it down for a few minutes.
Does it wipe out data from database instance during maintenance?
Definitely not.
If answer to first is yes, will using DBCluster help avoid that short
downtime, if I use more than one instances?
Yes, a database in cluster mode would fail-over to another node while they were applying patches to one node.
I am actively working of RDS Database system from the last 5 years. Based on my experience, my answer to your questions as follows in BOLD.
Database Instance be unavailable for the time of maintenance
[Yes, Your RDS system will be unavailable during maintenance of database]
Does it wipe out data from database instance during maintenance?
[ Definitely BIG NO ]
If answer to first is yes, will using DBCluster help avoid that short downtime, if I use more than one instances?
[Yes, In cluster Mode or Multi A-Z Deployment, Essentially AWS apply the patches on the backup node or replica first and then failover to this patch instance. Last, there would be some downtime during the g switchover process]

EDIT: How to restore instance from scheduled snapshots in GCP

I have a scheduled daily snapshot in GCP for one of my instances. I have several snapshots now. The first one is the full snapshot and the rest of the snapshots only contain changed data.
I want to be able to restore and boot the instance but it fails to boot. Checking the serial console I see reference to a blue screen and then it reboots and shows the same errors again, repeating the reboot cycle.
I have followed the guide in GCP on how to restore an instance from a snapshot by creating a new instance, selecting the snapshot tab and then selecting my snapshot. After saving the instance and trying to boot it I get the blue screen message.
Also, if I create a new instance and use a Windows 2008 R2 Datacenter image the system obviously boots fine but if I try to attach the snapshot disk as a secondary disk (non-boot) then I get the error: Editing VM instance failed. Error: Supplied fingerprint does not match current metadata fingerprint. I'm not sure if this is related to my issue with unable to boot the OS from my snapshot.
I did find a workaround:
1) create an image of running instance (my instance is Win'2008 R2 Datacenter)
2) enable scheduled snapshots of this new instance (with VSS)
3) wait for a scheduled snapshot to get created (hourly so must wait 1 hr)
4) create new instance from the scheduled snapshot
After all this work the instance boots just fine with all my data. Obviously not a very good workaround as now I have two instances with the same data. So I have to schedule the production system for maintenance so that I can bring it down and use the new instance so that future scheduled snapshots work if I try to restore it again. A major paint in the butt.
Anyone have any ideas as to why none of my instances boot from scheduled snapshots without my workaround? Manual snapshots work fine. And new instances also work fine with the same snapshot schedule.
I had this exact same problem. I tried multiple scheduled snapshots with the same result UNTIL I made a change in the VM Instance when attaching the restored snapshot. Maybe it's just Windows but if you named the disk something different then it seems to fail.
My original disk was called disk-1 for example. When I restored the snapshot I did it to disk-1-a and attached it to my instance. It failed the same way yours did. When I attach it and under "Device name" for the boot disk, select Custom and entered my original disk name of disk-1, it booted and RDP worked.

What is the Recovery Point Objective (RPO) of a single RDS instance?

I know there are automatic snapshots created every 24 hours, and that you can recover point in time in a minute timeframe. But what is the Recovery Point Objective (RPO)? Is this a minute? Or 24 hours because you need the latest daily snapshot? The documentation is not clear about this.
RPO Should be 5 mins https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIT.html
RDS uploads transaction logs for DB instances to Amazon S3 every 5 minutes. To determine the latest restorable time for a DB instance, use the AWS CLI describe-db-instances command and look at the value returned in the LatestRestorableTime field for the DB instance. In the AWS Management Console, this property is visible as the Latest restore time for the DB instance. You can restore to any point in time during your backup retention period.
Someone tested it back in 2012 with a powershell script. https://www.yobyot.com/aws/aws-rds-backup-recovery/2016/02/09/
As you can see in the screenshot below, a simple PowerShell script that ran for 20 minutes demonstrates that AWS is, indeed, making that very tight RPO possible. My little test instance was off only twice, by an insignificant minute or so.
Archived Link: http://archive.vn/8ZbuS https://web.archive.org/web/20190102131221/https://www.yobyot.com/aws/aws-rds-backup-recovery/2016/02/09/

RDS incremental backup

We are trying to take incremental back for mysql in RDS. We are unable to find any methods to take incremental backup . How can this be done in RDS ? In FAQ we read that we can restore the data up to last five minutes. But we are not sure how to do that?
You can use AWS Data Pipeline to do this.
It supports full RDS dump or incremental dump and restore.The problem is you cannot reuse a pipeline. You will have to clone the pipeline and create a new one using AWS Lambda or Jenkins or some other job scheduling system each time you want to create a Backup or Restore.
Check out this blog to find more information on that.
a. RDS provides Native incremental backup feature - RDS snapshots and also has a feature called Point in time recovery (PITR). This allows you to restore a state of RDS instance from last 5 minutes upto max 35 days in the past (35 days being the max automatic backup retention period).
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html
b. You can also trigger Manual snapshots in RDS - which is once again incremental (which means that if you have a running RDS server of 1TB your first/base snapshot will be 1TB) and any subsequent snapshots of the same server will only capture the modified blocks. In manual snapshots there is not retention period. You can keep as long as you wish unless you want to delete it manually. But the PITR feature is not available over Manual snapshots (i.e not longer than the configured automatic backup retention window)
In both the above features, you are dependent upon the RDS API/platform to take backup, list all the backups and restore RDS from backup. You dont have any control over the raw data / row level data.
For raw data backup, you need to consider Mysqldumps and restore - but that is an expensive operation (both backup and restore). You can use some third party tools like (percona) which provides good utilities to perform the same - but you cant use few tools because RDS does not allows you with RDS host access - so unless you run your own Mysql on VM/EC2, you are limited to the above 2 options. hope this helps.
https://www.percona.com/doc/percona-xtrabackup/2.3/innobackupex/incremental_backups_innobackupex.html
https://www.percona.com/doc/percona-xtrabackup/2.3/backup_scenarios/incremental_backup.html

Disabling AWS RDS backups when creating/updating instances?

I am creating new RDS MySQL instances from snapshots and updating their configurations both via the API and through the UI. Regardless of how I create or update instances, these actions automatically trigger new snapshots to be created through some kind of automatic backup process. Is there a way to disable snapshot creation when performing these actions since I do not need the additional snapshots and their creation is causing an unnecessary delay?
I spoke with AWS support and it looks like there is no way to prevent the backup being generated at instance creation time. This is due to how the backup creation on create/update is triggered (it is part of the automated backup process) and limited ability to control this feature (toggle it on and off, but only for existing instances).
Here are some more details in case anyone else runs into the same problems that I did.
I am interested in two scenarios:
Do not create a backup on a RestoreDBInstanceFromDBSnapshot request
Do not create a backup on a ModifyDBInstance request
The backups are controlled by this flag:
BackupRetentionPeriod = 0
Unfortunately this flag is part of an instance and of a snapshot, but can only be set on an instance. Therefore, in order to create an instance with this flag set (and thus no backup generated), the snapshot would have to have this flag disabled. This can only happen if the source instance had this flag disabled. At this point we could consider toggling the flag on the original instance when taking a snapshot, however disabling and re-enabling this flag has negative side effects, including:
There is a way to disable automatic backups for existing instances
however we highly discourage against this because it disables point-in-time
recovery. Once disabled, re-enabling them will only restore the backups
starting from the time you re-enable automatic backups.
We would lose all existing backups on the original instance. The end result is that there is not an effective way to avoid creating the first backup when an instance is created from a snapshot.
There is better news when updating an existing instance, since we can disable backups as part of the ModifyDBInstance request:
https://rds.amazonaws.com/
?Action=ModifyDBInstance
&DBInstanceIdentifier=mydbinstance
&BackupRetentionPeriod=0
Of course this still suffers from the loss of backups; however, my original purpose was to be able to create and modify snapshots of production databases, use them for a short period of time (hours), and then throw them away. Avoiding extraneous backup creation reduces overhead in this process.
Hopefully this information is useful to someone else!
If you create your RDS instance with Terraform using,
source = "github.com/terraform-aws-modules/terraform-aws-rds.git"
Although you must still set for example,
maintenance_window = "Mon:00:00-Mon:03:00"
backup_window = "03:00-06:00"
You can set
skip_final_snapshot= true
And the snapshot won't be created.
Shlomi