- Newest
- Most votes
- Most comments
Thank you for providing such a detailed explanation of your situation and concerns. I'll address your questions and provide some insights based on the information available.
Regarding your approach to upgrade, perform operations, and then downgrade:
-
Creating a DB instance from a snapshot in the same Availability Zone (AZ): There is no guaranteed way to ensure that a new DB instance created from a snapshot will be in the same AZ as the original. Using the same security group does not guarantee AZ placement. Amazon RDS automatically chooses the AZ when creating a new instance, and this choice is not directly controllable by users.
-
Upgrading from db.m5.2xlarge to db.m5.16xlarge and AZ placement: When modifying an instance size, Amazon RDS may need to move the instance to a different AZ due to resource availability. There's no way to ensure the larger instance stays in the same AZ (2a in your case) during the upgrade process.
-
Downgrading from 16xlarge non-multi-AZ to 2xlarge multi-AZ: When converting back to a multi-AZ deployment, you cannot control which AZ will host the primary instance. Amazon RDS manages this automatically.
Given these limitations, your proposed approach may not guarantee the AZ consistency you're looking for. However, there are some alternatives you could consider:
-
Instead of changing instance sizes, you could use Amazon RDS Performance Insights to identify and optimize the slow queries in your current setup.
-
For the specific operations you mentioned (creating indexes, vacuum/analyze, etc.), consider using maintenance windows and optimizing your queries rather than changing instance sizes.
-
If you need to perform these operations on a larger instance, you might want to create a new larger instance in your preferred AZ (if possible), perform the operations there, and then use a snapshot or logical replication to bring the changes back to your original instance.
Regarding your question about AWS Database Migration Service (DMS): DMS can be faster than pg_dump or snapshots in some scenarios, especially for large databases or when you need to minimize downtime. However, its performance depends on various factors such as network bandwidth, instance sizes, and data characteristics. For your specific use case, it might not provide significant advantages over your current approach.
Lastly, it's important to note that while keeping your resources in the same AZ can potentially reduce latency, it also increases the risk of all your resources being affected if there's an AZ-level issue. Amazon RDS is designed to work efficiently across AZs, so the performance impact of being in different AZs is usually minimal.
If AZ consistency is crucial for your application architecture, you might want to consider redesigning your application to be more AZ-agnostic, or explore using Amazon Aurora, which offers different multi-AZ deployment options that might better suit your needs.
Sources
Multi-AZ DB instance deployments for Amazon RDS - Amazon Relational Database Service
Upgrading the engine version of a Multi-AZ DB cluster for Amazon RDS - Amazon Relational Database Service
The AI Answer is Wrong I am afraid.
When you create a DB(restore) a snapshot under the VPC settings, you have the ability to Choose which AZ you want to create the Database Instance in. By default its set to no prefence. You can leave it or set an AZ as you wish.
On restoring the snapshot, it will be Single AZ also.
Hello,
you can also use the CLI, even for the upgrade/downgrade part, with the rds modify-db-instance command, which allows to specify the destination AZ. You just need to disable the Multi-AZ deployment option first.
