Elasticsearch perform snapshot incrementally - amazon-web-services

I have created a snapshot in AWS S3 and I am trying to update the same snapshot every day. Is it possible to do in Elasticsearch cloud-aws plugin ? Tried running the same create snapshot link but it doesn't updates the existing snapshot.

It is incremental by default.
Which means that you create a repository.
Then create a snapshot to this repo. This one is a full backup.
Then create a new snapshot to the same repo. This one is incremental.

Related

How can I change the time when AWS RDS automated snapshots are taken?

We have data ingests set to feed our prod AWS RDS Aurora database from 1am to 5am each day, and we re-create our stage database each day by restoring the latest prod automated snapshot.
Unfortunately, the prod automated snapshots currently occur at 12am, so the morning ingested data aren't yet in the snapshot, and we need the data to be there for the tests we run against the stage database upon deployment to prod.
Is there a way to change the timing of automated RDS snapshots, or do we just need to run a script that creates a manual snapshot to get our desired snapshot timing (i.e., after all needed data are in prod)?
'Automated snapshots' are snapshots that the Amazon RDS service takes to enable automated backups. These snapshots are taken within the backup window specified when first creating the database.
You will need to modify the backup window specified, which can be done in a variety of ways:
the console
the modify-db-instance CLI command
ModifyDBInstance RDS API operation (or equivalent SDK abstraction)
There is no need to create a script to create a manual snapshot in this case.

Restore AWS Backups to RDS using terraform

I have an AWS Backup plan which do a snapshot every day from a RDS instance, created by terraform. (This AWS Backup plan is not created by terraform).
The point is that I have to restore some of this snapshot without my tfstate lose the state of de whole deployment, because if I restore by hand, a new instance will be created and I would have to change the database endpoint in my application pointing to the new rds instance..
Using the aws_db_instance only allow to restore backups created by the own rds and I haven't found any resource to restore using terraform this snapshot..
Is there any way to restore an AWS backup snapshot without lose my tfstate? Could be the solution create the backups in the own RDS service using terraform?
Thanks in advance.
Sadly, you can't do this. You have to restore by hand, and then manually update your TF code to reflect the changes. This is the same situation when your RDS fail-overs due to failures. TF will not be aware of this, and you have to manually correct the drift.
We handled this situation in the following way in AWS to avoid changing any TF configuration:
Restore snapshot to new database db-new, ensuring that the configuration matches the original db
Modify original db to have a new identifier like db-old. Note that this will cause your endpoint to change, so your app will lose connectivity when AWS completes the modification.
Modify the db-new to have the original db identifier. This will change the endpoint to match the original endpoint.
Run terraform plan and see whether there are any configuration changes. Make sure to update the new db to match the config in the current TF state.
You should see that TF only updates a security group in place, and it sees the new db as matching the old db.

AWS Cloudformation Automatic Backup and Restore Redis CacheCluster

I want to enable automatic backups on my redis cluster on AWS.
Looking at the documentation I have to specify SnapshotRetentionLimit and SnapshotWindow. This kind of works and it creates the backup for me.
Now the problem is how can I use the latest backup and restore my redis cluster when it's restarted for example ?
I see there's a parameter SnapshotName:
SnapshotName
The name of a Redis snapshot from which to restore data into the new node group (shard). The snapshot status changes to restoring while the new node group (shard) is being created.
Which name should I include? Automatic backup creates backups with dynamic names (prefixes them with date and time). Can I somehow get the latest backup name through cloudformation template? Is this even possible via cloudformation template?
Thank you

Cloning one of the Database in AWS RDS in order to get a test DB

I am quiet new to AWS and trying to learn things. I currently have a live production environment and trying to create a test environment. I was able to create an image of an ec2 instance in AWS using the 'Create Image' option in the 'Actions'. Now I am trying to create an image/ duplicate of the RDS Database in AWS in a similar way. Is there any easy way to clone the database so that I don't change any data in the original database and perform modifications only in the test database. Thanks for all your help.
Probably worth reading up on creating snapshots and restoring from a snapshot.
To give you a quick summary; you will take a snapshot of your production RDS DB instance. Then you will launch a new DB instance from this snapshot.
As long as you don't need to launch the new instance in a separate AWS Account, the documentation should tell you all you need to know.

Amazon RDS: Backup and restore into new database on existing DB instance

I have a database hosted on Amazon RDS , which i need to take backup and create new database out of it. Being new, not sure how to do it. Tried doing from SSMS but it didnt work.
This is one of the top google results but there is some outdated information here.
You can enable sql native backup / restore for sql server in RDS, backup a single database to S3 and then restore that database to the same RDS instance with a new database name.
Steps for environment setup and performing the backup/restore:
Create an S3 bucket to store your native backups.
Enable Sql native backup by configuring a new option group for your RDS instance and adding the "SQLSERVER_BACKUP_RESTORE" option.
Executing a series of procedures in SSMS to run the backup and restore tasks:
exec msdb.dbo.rds_backup_database
#source_db_name='database_name', #s3_arn_to_backup_to='arn:aws:s3:::bucket_name/file_name_and_extension',
#overwrite_S3_backup_file=1;
exec msdb.dbo.rds_restore_database
#restore_db_name='database_name',
#s3_arn_to_restore_from='arn:aws:s3:::bucket_name/file_name_and_extension';
exec msdb.dbo.rds_task_status #db_name='database_name'
Note: I cannot find any announcement about removing this prior limitation:
You can't restore a backup file to the same DB instance that was used to create the backup file. Instead, restore the backup file to a new DB instance.
However, as of today, I can confirm restoring a native backup to the same instance works as you would expect.
You can do this in couple of easy steps using AWS console as well
Take RDS database snapshot. You might have already RDS snapshots. Check in AWS Console --> RDS --> Snapshots.
If you do not have snapshot, then RDS Instances --> Select the required instance--> Click on "Instance Action"--> Take Snapshot.
Then next Item is you have to create new RDS instance from this snapshot.
Go snapshots--> Select the snapshot you want to create instance. --> Click on "Snapshot actions" --> Restore snapshot.
In restore screen, for "DB Instance Identifier*", enter the name of new RDS instance.
There are certain restriction in restoring from snapshot like you can not change the size of the DB, version of software etc. New instance inherit these attributes from original database.
Take a look at the documentation for creating a DB snapshot and restoring from a DB snapshot.
I suppose you use SQL server RDS.
It is not clear if you want to restore database to the same instance or not.
Restoring backup on same instance under different name is not available in Amazon RDS
You can't restore a backup file to the same DB instance that was used to create the >backup file. Instead, restore the backup file to a new DB instance.
Troubleshooting part at
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html#SQLServer.Procedural.Importing.Native.Using.Poll
Also SQL Server native backup is not supported from SSMS in Amazon RDS since it requires to choose location for backup but in RDS you could not access OS resources.
There are few options:
1) Create another instance from snapshot,
2) if there are many databases and you want to restore only one, you need to enable SQLSERVER_BACKUP_RESTORE and use rds_backup_database to create a backup and rds_restore_database to restore it.
Prerequisite are to have S3 bucket and IAM account has access to S3 bucket
Steps should be:
change parameter SQLSERVER_BACKUP_RESTORE in option group. Be careful, it might require server reboot.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Appendix.SQLServer.Options.BackupRestore.html
call rds_backup_database in msdb database. Required parameters are database name and S3 bucket, optional are if you want to encrypt backup, overwrite backup with same name in S3 bucket, and back up type full or differential
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html#SQLServer.Procedural.Importing.Native.Using.Backup
Output of the procedure is task id and it can be used to check status of backup task.
exec msdb..rds_task_status #task_id= 5
After backup has been created, login to another instance and run rds_restore_database. Parameters are name of the database to restore and S3 bucket where the backup is located.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/SQLServer.Procedural.Importing.html#SQLServer.Procedural.Importing.Native.Using.Restore
If you want you can download backup file from S3 and restore it to SQL server on premise.
3) And the longest one if you want to have both database on same instance, to script database, create under different name and export data to the new database
The whole process is described here
UPDATE: Amazon allowed to restore database on the same instance where backup was created.
https://aws.amazon.com/about-aws/whats-new/2018/10/amazon-rds-for-sql-server-enhances-backup-and-restore-capabilities/