Where can I find AWS RDS snapshot hostname? - mysql

I have a MySQL instance running on RDS and I have created a snapshot and I read I can connect to snapshot. But I can't find snapshot specific hostname there on RDS management console. Can I really connect to AWS RDS snapshot using mysql client like I connect to instances?

There was an implication in the linked answer that you would need to restore the snapshot to an RDS instance. A snapshot isn't a live MySQL database -- you can't connect to it and use that state until you restore a new RDS instance from that snapshot. Here's how snapshots are defined in the documentation, if it helps:
DB snapshots are user-initiated and enable you to back up your DB
instance in a known state as frequently as you wish, and then restore
to that specific state at any time. DB snapshots can be created with
the Amazon RDS console or the CreateDBSnapshot action in the Amazon
RDS API. DB snapshots are kept until you explicitly delete them with
the Amazon RDS console or the DeleteDBSnapshot action in the Amazon
RDS API.
You can restore from a snapshot from the AWS console, or programmatically through the:
CLI: restore-db-instance-from-db-snapshot
API: RestoreDBInstanceFromDBSnapshot

Related

Error connecting to migrated RDS (from another aws account) from ec2

So we have two AWS accounts - one for stage and other for production. Now in stage, there is ec2 in public subnet and rds in private subnet. Ec2 and rds are connected to each other. Data is also populated in stage environment's rds.
Now we have migrated this ec2 and Rds to production aws account.
So the steps I followed for rds migration :
Created rds snapshot in stage -> copy snapshot -> share snapshot with production.
Opened production account -> copied shared snapshot -> Restore snapshot.
But now when trying to connect to this new migrated rds from production ec2 via Mysql workbench, it is giving error "Failed to connect to Mysql at xxxx...:3306 with user xxxx. Host private_ip_of_ec2 id not allowed to connect to this mysql server"
Stange thing, I tried crreating a new rds in production aws account, and it can be easily connected from ec2. Only the migrated rds from stage aws account does not connect.
Can somebody help in this issue ?
Note :
rds master username and password are same in both stage and production accounts.
ec2 was in public subnet in stage, but in production it is in private subnet.

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.

Does AWS RDS support two way replication with local MySQL database?

I would like to sync the local MySQL database to Amazon RDS MySQL database. I found a solution for EC2 to RDS but not for Local Database to RDS.
I built a database including 12 tables which all I want to get backup them to cloud periodically or automatically.
I do not want to run EC2 server since I need only MySQL database to get backup on cloud.
I need a solution like Microsoft Database Sync Agent. Whenever changes detected in Local Database, it should be synced to the cloud database. How can I make this happen?
You could use the AWS Database Migration Service:
AWS Database Migration Service (AWS DMS) is a cloud service that makes it easy to migrate relational databases, data warehouses, NoSQL databases, and other types of data stores. You can use AWS DMS to migrate your data into the AWS Cloud, between on-premises instances (through an AWS Cloud setup), or between combinations of cloud and on-premises setups.
With AWS DMS, you can perform one-time migrations, and you can replicate ongoing changes to keep sources and targets in sync.
You can achieve this by following below steps.
Make a replica of local server to RDS.
Enable Query logging in local Database
Create a cron job which will process logging queries and it will execute queries on RDS instance in same order.
To generate a replica to RDS you can follow below steps.
You can't replicate your local database to RDS directly. Your need to dump you data and then after you can import it on RDS.
Instead of generating a dump file you can directly import data into RDS using below command.
mysqldump db_name | mysql -h 'other_hostname' db_name
You can find our more about this over here.
https://dev.mysql.com/doc/refman/5.7/en/copying-databases.html
Also first import tables & it's data then after import your triggers, routines & events. If you import together then there is a chances to get conflict and you job will be terminated.

AWS RDS vs MySql database directly on EC2

I created MySql database directly on EC2 instance (I host there my web app and database), I didn't set up RDS. But my database constantly keep crashing. So now I want to use RDS.
How to integrate my existing databases on EC2 with RDS?
By integrate I mean simply how to migrate them to RDS that they stop crashing on EC2 instance. Do I have to remove them from EC2, stop mysqld service on EC2 and then create them from scratch on RDS and change database access configurations in my apps or is there simpler way?
Unload your data from the SQL instance into CSVs. Put it into S3. Terminate your EC2 instance. Spin up RDS instance. Load data out of S3 into RDS. Job done.

How Ruby on rails works with Amazon RDS

I have a ruby on rails run on amazon ec2, database is mySQL.
Now I want to use Amazon RDS to backup this database in case the ec2 fails.
I read through the Amazon RDS user guide,it tells how to create a DB instance.
My question is:
1.what is the relation between created DB instance and my ec2 database?
2.When the DB instance "connect" to my ec2, what will happen?
The data used to send to ec2 mySQL server will be send to DB instance?
Is the database totally shifted to DB instance?So before I connect I should creare a same database in DB instance and tell ec2 send data to RDS ever since
3.If not,how the DB instance know the ec2 is down and takeover the data?
EDIT:
(Unsure)Is it that DB instance is just a place to put database.In order to use it,I need to set up database in DB instance,then connect to it by modifying database.yml file(this file tell rails server where the stored data goes).
How Is it possible to tell when the local database stops then at that time switch to DB instance?
There is absolutely no relationship between your EC2 MySQL DB and the RDS DB Instance. So what you are asking for is just not possible.
A better approach I would say is to have only RDS (No need to have MySQL running locally on EC2 instance). RDS takes snapshots regularly. Also, RDS is a managed service, so most of the MySQL administration tasks are handled by AWS and you don't have to worry. And you can rely on RDS snapshots from Backup perspective.