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

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.

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?

Azure DB synch up - DB on VM to a separate DB on another VM

I have a Azure VM configured as DB server with a mySQL instance.
I want to replicate the DB to another Azure VM with a mysql instance. The replication has to be ongoing in near real time say every 5 mins. This is to use the second DB for a separate application. How do I go about the same?
If you don't wan to use ELT/ETL tools or services, I just have this workaround:
Create the MySQL instance backup file in Azure VM 1.
Upload the file into Azure Storage or other cloud storage.
Download the backup file from the Azure Storage in Azure VM 2 and
restore it.
HTH.

How to preserve the configurations of ProxySQL after restarting the EC2 instance?

I've followed the tutorial here and set up a ProxySQL v2.0.2 service on an Ubuntu AWS EC2 instance.
One thing that troubles me is that the configurations of ProxySQL are gone after the EC2 instance restarts.
For example, before the EC2 instance restarted, SELECT * FROM mysql_servers; returns the backend databases I've added to ProxySQL. But after the EC2 restarted, SELECT * FROM mysql_servers; returns an empty set. And I must re-configure ProxySQL to allow the clients to connect to databases through ProxySQL.
How can I preserve the ProxySQL configurations after the EC2 instance restarts?
Why can't SAVE MYSQL VARIABLES TO DISK; command preserve the configurations?
I configure ProxySQL using the admin interface.
I've tried adding servers in mysql_users section of /etc/proxysql.cnf file. But it seems that it has no effect at all. This is strange.
According to this document, I should use SAVE MYSQL SERVERS TO DISK to save the mysql_servers configuration to the disk.
SAVE MYSQL VARIABLES TO DISK; is used to save other variables to the disk.

restore snapshots from another instance

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

MySQL on Amazon?

I'd like to have 20 different Amazon EC2 instances that read and write from the same shared location. Is it at all possible?
Also, is it possible to have an instance of MySQL that will be accessible from all 20 Amazon EC2 instances?
You could use Amazon's RDS which offers a managed MySql service which all your instances could access. Otherwise yes of course it is possible to have a single MySql instance running which all your other instances can access in which case you will need to configure MySql to allow remote connections and open the EC2 port (3306 by default) on the database server.
The whole idea of a database server is to provide a shared data repository. If you can get to your single MySQL instance over the network, you shouldn't have a problem.