restore snapshots from another instance - mysql

I have 2 amazon rds instance (one for production, and another for development/testing). Now I want to restore one database from production instance to my development instance. I am taking snapshots on my production instance, but there is no options to restore snapshots on development instance from another instance.
Is there any way to do this without downloading snapshot?

Restoring from snapshot means creating a new RDS instance, so you will basically be replacing the old development instance with a new one.
First you have to either delete or rename the original development instance, otherwise it's name can't be reused for the new instance.
If you want an RDS instance with both the development schema and production schema, then you'll have to transfer the data using database-specific tools (e.g., mysqldump if you're using MySQL, data pump if using Oracle, etc).

You can modify the attributes on the (production) snapshot and allow another AWS account (Dev, in your case) to access it
aws rds modify-db-snapshot-attribute --db-snapshot-identifier $SNAPSHOT_NAME --attribute-name restore --values-to-add "<ACCOUNT NUMBER FOR DEV>" --output=json
Attribute name = Restore, because you are having dev account restore from this snapshot.
in your dev console, you will find this on the "Shared snapshots"

Starting Late 2015, the sharing of snapshot has been added as a feature by AWS.
Sharing Snapshot across AWS Accounts

Related

Unable to decouple postgres db from ElasticBeanstalk Instance

We have an ElasticBeanstalk instance, with an internal postgres database.
As you know, there's the possibility to have internal (coupled) or external (decoupled) databases on ElasticBeanstalk
Since last year, there is the possibility to decouple internal databases from an ElasticBeanstalk instance, since these are coupled or 'tied' to the instance itself.
We want to have an external database instead of the internal one, because the new external database is encrypted, anyway, that's the reason why we want to decouple the existing one.
But if I go EB->Environments->Environment->Configuration->Database section
Then click 'Decouple Database', it shows me a MySQL related error (???), the db is postgres, no doubts about it, there's no hint to MySQL at any point in the lifetime of this EB instance.
And if I try from the eb cli the error is different but always MySQL related:
Any ideas about this?

Archiving AWS RDS mysql Database

I am looking for options to archive my old data from specific tables of an AWS RDS MySQL database.
I came across AWS S3, AWS Glacier and copy the data to either one using some Pipelines or Buckets, but from what I understood they copy the data to vault or backups the data, but don't move them.
Is there a proper option to archive the data by moving from RDS to S3 or Glacier or Deep Archive? i.e., deleting from the table in AWS RDS after creating an archive.
What would be the best option for the archival process with my requirements and would it affect the replicas that already exist?
The biggest consideration when "archiving" the data is ensuring that it is in a useful format should you every want it back again.
Amazon RDS recently added that ability to export RDS snapshot data to Amazon S3.
Thus, the flow could be:
Create a snapshot of the Amazon RDS database
Export the snapshot to Amazon S3 as a Parquet file (you can choose to export specific sets of databases, schemas, or tables)
Set the Storage Class on the exported file as desired (eg Glacier Deep Archive)
Delete the data from the source database (make sure you keep a Snapshot or test the Export before deleting the data!)
When you later wish to access the data:
Restore the data if necessary (based upon Storage Class)
Use Amazon Athena to query the data directly from Amazon S3
Recently I did build a similar pipeline using AWS lambda that runs on a cron schedule(Cloudwatch event) every month to take a manual snapshot of the RDS, export it to S3, and delete the records that are older than n days
I added a gist of the util class that I used, adding it here if it helps anyone
JS Util class to create and export Db snapshots to S3
PS: I just wanted to add it as a comment to the approved answer but don't have enough reputations for that.

How to extract data from a snapshot or instances of AWS?

I cannot access one of my AWS instances via SSH or MySQL, it is inaccessible, but I know that the data contained in it is still intact, but I need some files that are within that instance, I would have access to that instance in any way just to recover that data?
I have some Snapshots of it, but as soon as I upload these Snapshots, I still have no access to the machine, because the Snapshots were generated after the problem in the isntancia, if somehow I could access the data of this Snapshot.
Launch a new EC2 instance and mount this volume as a secondary volume.
On Linux EC2:
You can mount the volume using fstab, after assigning volume to EC2.
On Windows EC2
Use disk management utility to mount the volume.
Finally terminate the new instance after getting your files.

Restoring SQL backup on Amazon RDS database

How is it so difficult to find out how to do this? All I need is to run some simple SQL to restore our existing database on a new RDS database.
Tried connecting with SQL Server Management Studio, it won't connect.
Tried using the Database Migration Tool, it doesn't make any sense.
All the documentation for this seems to assume I'm trying to move some monumental database with zero downtime. Literally all I need to do is run an SQL file on a RDS database. Does anybody on earth understand how this works??
You can use Native backup and Restore. Amazon RDS supports native backup and restore for Microsoft SQL Server databases using full backup files.
Though it wouldn't work on db.t1.micro DB instance class.
You can add Native Backup and restore option by doing following according to the AWS docs.
Create a new option group, or copy or modify an existing option group.
Add the option to the option group.
Associate the option group with the DB instance.
After you add the Native Backup and Restore option, you don't need to restart your DB instance. As soon as the option group is active, you can begin backing up and restoring immediately.
If you cannot connect to the you need to check your RDS security group. Make sure port 3389 is open to your IP,
There is good documentation for connecting to RDS from the Management Studio here:
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToMicrosoftSQLServerInstance.html
It states the following:
After Amazon RDS provisions your DB instance, you can use any standard
SQL client application to connect to the DB instance. In this topic
you connect to your DB instance by using either Microsoft SQL Server
Management Studio (SSMS) or SQL Workbench/J.
Also double check that the RDS instance is on a public subnet and that you have allowed public access to it. See those settings in Configure Advanced Settings:

Amazon AWS RDS Instance organisation

I am migrating to Amazon Web Services. I have a production site and associated mySQL Database, and I also have a staging site to try out changes prior to pushing to production.
In terms of AWS RDS, how do I manage these two databases? Should they both exist in the same instance, or should they each have their own instance?
My staging site does not have to be continuously available, does this change which option is best suited?
I think those databases should live in different instances. Production DB should definitely have its own instance. There are many reasons to that:
What happens if you have a bug in staging and you spam your instance with CPU-eating queries? If it is the same instance your production DB might be effected.
It is good to have instance monitoring only for production.
You will be able to set up configuration on the production instance that should not be set on staging such as multi-az availability.
You can stop the staging instance when ever you want and re-start it with just the data it had when you stopped it.
All in all, no reason to mix the two into the same instance. One for production, one for staging.