- Newest
- Most votes
- Most comments
I managed to solve this.
I was able to reduce the size of the storage by allocating 100 GB, which is about +65% of the used space according to CloudWatch. That deployment completed successfully.
I’m still not sure if it would have worked with a value somewhere between the previously tested 80 GB (already +35% of used space) and the working 100 GB.
At one point I suspected the extra space requirement might be related to the file system configuration upgrade step mentioned in the docs/blog. To test this, I tried creating a read replica with the current filesystem, promoted it, and then attempted to reduce the storage to 80 GB. That failed with the same “valid target-allocated-storage values” error.
So in practice, the lower bound seems to be stricter than the blog’s +20% rule, at least for my instance.
Takeaway: If you run into this issue, don’t just aim for the minimum +20%. In my case, I needed closer to +65% of used space before the Blue/Green deployment succeeded. It may be worth experimenting with higher values if the lower bound fails.
To successfully reduce RDS storage size using Blue/Green deployment, you need to follow specific guidelines and understand certain limitations:
Steps for RDS Storage Reduction via Blue/Green Deployment
- Create a Blue/Green Deployment through the Amazon RDS console:
- Navigate to the storage section
- Set the allocated storage for the green database to your desired smaller size
- For example, if your blue database is 400GB, you could create a green database with 200GB
- Wait for Deployment Completion:
- The creation process may take hours or days depending on database size, storage type, and IOPS
- Monitor the progress until the green environment shows as available
- Perform the Switchover:
- Once the green environment is fully deployed and available, orchestrate a managed switchover
- The promotion process is quick and can be completed in as little as a minute with no data loss
- Clean Up:
- After successful switchover, delete the blue/green deployment
- Delete the old blue instance to save on costs
Regarding Your Specific Issue
Your calculation approach is correct in principle, but there might be several reasons for the failure:
-
Engine Support: Ensure your MySQL version is fully supported. Blue/Green Deployments with storage shrinking is available for MySQL major versions 5.7 and higher.
-
Hidden Constraints: There might be additional factors beyond the 20% rule:
- The system might be calculating used space differently than your CloudWatch metrics suggest
- There could be temporary storage usage not reflected in the FreeStorageSpace metric
- MySQL might have specific storage requirements based on your database configuration
- Storage Optimization: Before attempting the Blue/Green deployment:
- Consider running OPTIMIZE TABLE operations on large tables
- This can help reduce fragmentation and ensure more accurate space calculations
- Alternative Approach: If Blue/Green deployment continues to fail, you could consider:
- Creating a new RDS instance with lower allocated storage
- Using AWS DMS Serverless to migrate data from your current database
- This approach has been successfully used for significant storage reductions
Remember that the Blue/Green deployment method for storage reduction is relatively new (announced in November 2024), so you might be encountering edge cases in the implementation.
Sources
Amazon RDS Blue/Green Deployments support storage volume shrink - AWS
Shrink storage volumes for your RDS databases and optimize your infrastructure costs | AWS Database Blog
Scaling Amazon RDS for MySQL performance for Careem’s digital platform on AWS | AWS Database Blog
Managing capacity automatically with Amazon RDS storage autoscaling - Amazon Relational Database Service
Relevant content
asked 2 years ago
asked 2 years ago
asked 2 years ago
