Amazon RDS - multi AZ - amazon-web-services

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.

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!

Which availability zone does RDS failover to?

I created a database in RDS and I was wondering where in the dashboard do you see the failover AZ. Under summary I can see the AZ of the instance which I assume is the master but where is the slave located? How do I know which AZ it will fail over to?
The subnets in which you launch your multi-az deployment RDS instances determine the availability zones for your master and slave (Primary and secondary) RDNS instances.You can also check the secondary server AZ from the Replication section at the bottom of the database configuration details.
If you selected "Do not create a standby instance" at the time of creation of the RDS instance ,then you will not see any secondary RDS instance.

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

Common AWS failures - Handling AZ failover

Specifically I have a question what is the recommended way to organize AZ failover in AWS environment. Also it will be good to understand typical AWS failures in order to organize Application HA (High Availability).
So, Application architecture (AWS services usage) is following:
It's more/less typical Web Applications architecture in the AWS
There is route 53 that resolves ip of some ELB.
There is public subnet that has ELB and it routes traffic to Web Servers to private VPC;
In the private subnet traffic goes: Web Servers -> ELB-> Application Servers;
Application Servers writes data to Multi-AZ RDS.
The main drawback with such deployment that services are active in one AZ because in a Multi-AZ deployment, Amazon RDS automatically provisions and maintains a synchronous standby replica in a different Availability Zone. So, master is only in one AZ and services in another AZ is not allowable to write to RDS because it's standby.
Two questions:
What is the better way to implement HA for such deployment?
What is the common AWS failures (if one AZ is unavailable whether it's often happens only with some services (e.g. VPC/EC2/EBS other issues?)or usually it's whole AZ specific services are not available)?
Considerations about HA for such approach:
RDS. From AWS docs: "In the event of a planned or unplanned outage of your DB instance, Amazon RDS automatically switches to a standby replica in another Availability Zone if you have enabled Multi-AZ. The time it takes .....". So, AWS Automatically will change RDS Master.
Active/Not active AZ. Different health checks can be added to Route53 and basically make Active another AWS AZ. But How to make it synchronously with RDS (only after RDS becomes master in another AZ make this AZ active)?
Update
Another reason to maintain one active and one passive AZ is that our application servers should support stickiness by device IP address (e.g. It keeps session based on user's or device's IP). And we have 1 EC2 Web Server instance in each AZ that maintains it (we can't allow to go requests to different AZ(s)).
I think you misunderstand how availability zones work. Services in one AZ can connect to the RDS master in a different AZ. You should have all services running in at least 2 AZs.
For RDS, when then master fails or the AZ the master is in goes down, the RDS service will promote the standby to master and update the DNS for the RDS endpoint so that the endpoint will then point to the new master.
All you code needs to do in order to handle an RDS failover is to gracefully handle sudden DB disconnects with a retry.

Amazon RDS Read Replica in Same Region, Different VPC

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