Amazon RDS Read Replica in Same Region, Different VPC - amazon-web-services

For version cut-over, I am using CloudFormation to spin up a new infrastructure with a new VPC, Subnets, and Security Groups. I want a copy of my production database in the new VPC (same region). I do not want to use a Snapshot, because that would require me to take the app down for a while (after the snapshot is taken, any new data will be lost, so I have to shut down the app).
I want to create a read-replica into the new VPC/SecurityGroup/Subnets, and then when I am ready for cut-over I will promote that read replica. Is this possible?
AWS documentation gives clues that creating a read replica across VPCs in the same region is not supported, but does not explicitly say so. Alternately, I am open to moving the database after promotion.
Thanks
P.S. example of what I mean by "clue":
"Within a region, all cross-region replicas created from the same source DB instance must either be in the same Amazon VPC or be outside of a VPC."
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReadRepl.html
This almost answers my question... But what about replicas created in the same region as the source DB?

It is not supported.
You can do a read replica within the same VPC, then take a snapshot of the replica and restore it on the other VPC.

You can actually do this using external MySQL replicas. You will need appropriate routing and security groups between your VPCs. As long as your VPC subnets can communicate with each other, create a replica, stop replication on it and record the binlog position info where it was stopped. Take a snapshot of the replica and use that to spin up a new RDS instance in the new VPC, now set the external replica to your old RDS instance and start replicating where the binlog position was recorded. You've now got a master RDS instance in your new VPC, replicating from the old VPC.
This article covers it in easy to follow steps:
http://quiddle.net/post/78453641455/migrating-rds-from-ec2-to-vpc

Related

How to prevent AWS RDS instances from changing AZs after Multi AZ true/false

I have an RDS instance that has a waiting required OS update, So I decided to open Multi AZ while applying the update. Update is finished, everything is fine, but I realized that AWS RDS instance is staying in us-east-1b, I was using us-east-1a. I closed the Multi AZ and configured DB as single AZ again, but my AZ config wasn't be applied back. it's still in us-east-1b. However, most of my resources are in us-east-1a and I don't want to pay for extra inter-AZ networking cost.
Is there a workaround for this,
Any help will be highly appreciated,
Thank you very much.
AWs doesn't give the option to choose in which zone to create seconday rds. If you can have a maintenace period of let's say 1 hour(depends on how big is the RDS), you can create the db from snapshot in the AZ of your choice but if it's not possible, the only option is to change to MultiAZ and hope the secondary DB is created in us-east-1a. Once you have it here, turn off MultiAZ.
Tur on multiAZ again
Restart database with force failover parameter.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_RebootInstance.html
Turn off multiAZ
You can create DB subnet zone in your preferred AZ, then create a snapshot of your database. From the snapshot you can restore a new database and assign the create subnet group while restoring that database which will create your instance in AZ of your choice. Hope this resolves your issue!

Are security groups replicated/copied when creating RDS read replicas in a different AWS region?

I have a security group attached to an RDS instance that allows port 5432 traffic from the EC2 instances.
The RDS instance has a read replica created in a different region.
From my understanding, AWS will take care of replication and add the necessary configuration by itself for replicating source RDS data to the read replica.
For me to be able to read data from the read replica, all I need to make sure is to allow incoming traffic to the read replica in the other region.
Are security groups copied over from the DB instance to the read replica?
Do I need to create a new security group for the read replica?
Do I need to create a new security group for the read replica?
Yes.
You will need to configure a new security group for the cross-region read replica.
As per Amazon RDS User Guide for cross-region read replicas:
The read replica uses the default security group.

Do my AWS EC2 instances need to move into my VPC when I move our RDS instance?

We have an AWS account with multiple EC2 instances and an RDS instance. These have been running since before VPCs were introduced. Now I need to upgrade the RDS instance class and the new class can only be established in a VPC. So if our RDS instance is modified (converted) into the new class and the new RDS instance is in a VPC will the EC2 instances that use this RDS need to be moved into the VPC at the same time or can this be a separate process?
RDS and EC2 security groups are not cross-compatible between classic and vpc EC2. If you have an RDS with an EC2 sec group reference you will not be able to add a classic ec2 sec group to your vpc RDS sec group.
Differences Between Security Groups for EC2-Classic and EC2-VPC
Your best bet is to migrate your EC2 infrastructure to VPC along with your RDS. You can of course grant global access to your RDS if you want to separate the process and then lock it back down when you've migrated your EC2 infrastructure but this is a big no no (huge security risk).
This is a non trivial process and I feel your pain. The least complex thing is to incur downtime during migration so that you don't have divergence between RDS instances. But that's not ideal especially when you have a large RDS storage-wise. BTW, you will want to test how long the process takes to snapshot and restore the RDS since it might take a while.
An alternative if you can manage it is to force your app to use read-only replicas while you migrate the RDS. That way your app can still function (kind of) and you won't have to worry about reconciliation between RDS instances post-migration. But obviously your app needs to be aware that it's in read-only mode or you'll end up with erratic behavior.
Forgot to mention there is something called classic-link which might help here but I've personally never used classic-link. Check it out in an AWS whitepaper write up here:
Move Amazon RDS MySQL
Databases to Amazon VPC
using Amazon EC2
ClassicLink and Read
Replicas

What's the difference between Cluster and Instance in AWS Aurora RDS

I guess the title is pretty objective, but just to clarify:
When you create an Aurora Database Instance, it is asked to give a name for a Database Instance, a Database Cluster and a Database (where the name of the Database is optional, and no databases are created if it is not specified...). When you create another instance, you have to give the name for both again, and neither of them can be the same one as the first ones.
So, what's the difference between an Aurora Database Instance and an Aurora Database Cluster?
Also, can (and when do) you connect to each one of them?
Thanks!!
An Aurora cluster is simply a group of instances. By default, Aurora will create two instances in a cluster - one for reads and the other for writes. But you can change that configuration to be whatever you need.
For the names:
Database Cluster is the name of the cluster that holds the instances
Database Instances are the names of each instance in the cluster. By
default, if you named the instances "mydb", AWS will append the AZ to
the name. So it would become "mydb-us-east-1c" for example.
Database Name is the name of the initial database that will be created within Aurora. Think database like where you will add tables and data. If you do not specify a Database Name, you will just need to create your own - which is likely what you want to do anyway.
To connect, just point your application at the cluster endpoint. RDS will route traffic and handle failovers for you.
I will try to explain the setup in a simpler way. Hope this will answer all the questions in the end.
An Amazon Aurora DB cluster consists of one or more "DB instances" and a "cluster volume" that manages the data for those DB instances. Each Aurora DB cluster will have one primary DB instance for sure.
Despite from RDS instances, the major difference is that RDS Aurora instances don’t contain any data. They simply facilitate the reading and writing to the Aurora cluster [ Refer the diagram here ]. It’s the Aurora cluster that contains the data. That is why Aurora snapshots are not considered "DB snapshots". Instead, they are considered "cluster snapshots".
There are two endpoints associated with any Aurora cluster;
Cluster endpoint (or writer endpoint)
Reader endpoint
A cluster endpoint (or writer endpoint) for an Aurora DB cluster connects to the current primary DB instance for that DB cluster. A reader endpoint for an Aurora DB cluster provides load-balancing support for read-only connections to the DB cluster.
If the cluster only contains a primary instance and no Aurora Replicas (because we can create like that), the reader endpoint connects to the primary instance. In that case, you can perform write operations through the endpoint.
Links:
https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/Aurora.Overview.Endpoints.html
https://blog.skeddly.com/2018/01/rds-db-and-cluster-snapshots.html

Amazon RDS - multi AZ

I want to take a multi AZ RDS db instance with Amazon. But from their FAQs or guidelines I cannot find if I can select a specific AZ for the standby DB. I understand that the secondary DB will be in the same Region. Can anyone tell me if it is possible to select the AZ of the stand by ?
When you select Multi-AZ deployment for the RDS instance, Amazon will manage the Master and Slave placement within the defined VPC.
This is because, when a failure happens, AWS is able to promote the secondary instance as master to handle the requests, while other database failovers.
Note: You are only able to select the Availability Zone if you are provisioning a single instance.