diff --git a/knowledge base/cloud computing/aws/rds.md b/knowledge base/cloud computing/aws/rds.md index 6b7b868..d7f65e2 100644 --- a/knowledge base/cloud computing/aws/rds.md +++ b/knowledge base/cloud computing/aws/rds.md @@ -49,8 +49,12 @@ aws rds modify-db-parameter-group --db-parameter-group-name 'pg15-source-transpo # Restore instances from snapshots. aws rds restore-db-instance-from-db-snapshot \ - --db-instance-identifier 'myNewBbInstance' \ - --db-snapshot-identifier 'myOldDbSnapshot' + --db-instance-identifier 'myNewDbInstance' --db-snapshot-identifier 'myDbSnapshot' + +# Restore instances to point in time. +aws rds restore-db-instance-to-point-in-time \ + --target-db-instance-identifier 'myNewDbInstance' --source-db-instance-identifier 'oldDbInstance' \ + --use-latest-restorable-time # Start export tasks. aws rds start-export-task \ @@ -201,6 +205,9 @@ After automated backups are deleted, they **cannot** be recovered. Should one choose to have RDS create a final DB snapshot before deleting a DB instance, one can use that or previously created manual snapshots to recover it. +Taking backups can be unbearably slow depending on the amount of data needing to be copied.
+For comparison, the first snapshot of a DB instance with standard 100 GiB `gp3` storage took about 3h to complete. + ### Automatic backups Automatic backups are storage volume snapshots of **entire** DB instances. @@ -375,10 +382,26 @@ original instance had allocated at the time the snapshot was taken. ```sh aws rds restore-db-instance-from-db-snapshot \ - --db-instance-identifier 'myNewDbInstance' \ - --db-snapshot-identifier 'myDbSnapshot' + --db-instance-identifier 'myNewDbInstance' --db-snapshot-identifier 'myDbSnapshot' + +aws rds restore-db-instance-to-point-in-time \ + --target-db-instance-identifier 'myNewDbInstance' --source-db-instance-identifier 'oldDbInstance' \ + --use-latest-restorable-time ``` +Should source snapshots be from an instance with automatic backups enabled, the restored DB instance will backup itself +right after creation.
+Refer the [Backup] section for what this means. + +> There is currently **no** way to prevent the backup being generated at instance creation time.
+> That process is triggered automatically and the feature can only be toggled on and off for existing instances. +> +> The `BackupRetentionPeriod` flag is part of both instances and snapshot definitions, but can only be set on +> instances.
+> To create instances with this flag set to `0` and thus have **no** backup automatically taken, the source snapshot +> _must_ have this flag already set to `0`. This can only happen if the source instance had the flag set to `0` when the +> snapshot was taken in the first place. + ## Encryption RDS automatically integrates with AWS KMS for key management. @@ -722,6 +745,7 @@ Solution: reboot the source and target instance and retry. - [Renaming a DB instance] - [Amazon RDS DB instances] - [Maintaining a DB instance] +- [Disabling AWS RDS backups when creating/updating instances?] +[backup]: #backup + [s3]: s3.md @@ -757,3 +783,4 @@ Solution: reboot the source and target instance and retry. [backing up login roles aka users and group roles]: https://www.postgresonline.com/article_pfriendly/81.html +[disabling aws rds backups when creating/updating instances?]: https://stackoverflow.com/questions/35709153/disabling-aws-rds-backups-when-creating-updating-instances