aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
aster.cloud aster.cloud
  • /
  • Platforms
    • Public Cloud
    • On-Premise
    • Hybrid Cloud
    • Data
  • Architecture
    • Design
    • Solutions
    • Enterprise
  • Engineering
    • Automation
    • Software Engineering
    • Project Management
    • DevOps
  • Programming
    • Learning
  • Tools
  • About
  • Public Cloud

Regain Cloud SQL Disk Space With Database Migration Service

  • aster.cloud
  • March 27, 2022
  • 4 minute read

So you made a mistake, you pushed an application change that accidentally caused a massive surge of data to hit your database. And now your instance has made happy use of the feature of automatically expanding your storage when you get close to running out of disk space. Most of the time, this is a lifesaving feature that prevents downtime due to a gradually increasing database running out of space. But this time a mistake causes your storage to spike much higher than it normally would. Thankfully you’ve now fixed the application bug and your database isn’t being overrun anymore, but the damage has been done and now your disk is much bigger than it needs to be. And while the adage “Storage is cheap” might be true, if you’re renting it instead, you want to be sure you’re not paying for too much space you’re not using.

There’s not (yet) a good way to simply shrink the size of your Cloud SQL instance’s disk. Block storage, while giving us the performance we want, unfortunately is a bit more challenging to shrink down to size. If you look at what’s out there as techniques for doing things like this, the advice is often to take an export of your data, create the new instance, and import the data into the instance with an appropriately sized disk. Or be a bit sneaky, and set up an external replica (which can have a smaller disk size than the primary unlike a regular replica), then promote once things are all sync’d up.


Partner with aster.cloud
for your next big idea.
Let us know here.



From our partners:

CITI.IO :: Business. Institutions. Society. Global Political Economy.
CYBERPOGO.COM :: For the Arts, Sciences, and Technology.
DADAHACKS.COM :: Parenting For The Rest Of Us.
ZEDISTA.COM :: Entertainment. Sports. Culture. Escape.
TAKUMAKU.COM :: For The Hearth And Home.
ASTER.CLOUD :: From The Cloud And Beyond.
LIWAIWAI.COM :: Intelligence, Inside and Outside.
GLOBALCLOUDPLATFORMS.COM :: For The World's Computing Needs.
FIREGULAMAN.COM :: For The Fire In The Belly Of The Coder.
ASTERCASTER.COM :: Supra Astra. Beyond The Stars.
BARTDAY.COM :: Prosperity For Everyone.

There’s nothing wrong with doing that. Those methods really are the right ways to do this. But setting up the infrastructure to do it right on top of keeping production systems running, as well as all of them involving at least some downtime, might be a cost-benefit analysis that results in just leaving the disk alone and calling it good enough.

Read More  VMware Refreshes vRealize Cloud Management To Better Optimize, Protect And Modernize Customers’ Hybrid And Multi-Cloud Environments

At the end of the day, this process is akin to a migration, from the existing instance that’s grown unnecessarily to a right-sized instance. To make migrations a bit less daunting, we’ve built Database Migration Service. Google’s managed migration service makes this nice and simple. You just need to define a connection profile for the Cloud SQL source instance you want to reduce the disk for, and DMS guides you through creating the destination instance where you can specify the smaller disk.

DMS Connection Profile UI

There are some things to think about which can make this a bit easier. First, you need to have your instance prepared for migration, which can, depending on your set up, involve a restart of the database. If you haven’t ever migrated a database, we’ve got a couple good blog posts for MySQL and PostgreSQL.

Second, the IP address your application uses is going to change because you’ll need to point at the new instance once it’s promoted. Now, one thing is that with DMS, when you set up the migration, you can set it up as a streaming migration. So no worries about the export/import catch up that you might normally need to do. This will persist right up until you promote the new instance to be the primary. This means you can take the time you need to prepare the application and other tooling, as well as testing the new instance before cutting over.

One way to account for that is that you can leave the target instance as a replica while you cut over all applications. That way you have coverage by leaving both instances up while your applications catch up with the new IP address. This results in the least downtime, but there may be complications depending on how the data in the database is being used by the applications.

Read More  How Wayfair Says Yes With BigQuery—Without Breaking The Bank

A good way to future proof this if you’re not doing it already, is have your application use the Cloud SQL Auth Proxy.

Cloud SQL Auth Proxy Diagram

Of course if you have an established instance this would result in downtime as well as the logic would have to change in the application to point at where you have the proxy running (preferably on the same machine as the application) and you’d have to cut over. The benefit of having it this way is that repointing the application involves the briefest of downtime while you shut down the proxy pointing at the old instance and restart it pointing at the new one.

Other ways of doing a similar thing would be things like putting a load balancer or HTTP proxy in front of the instance so that your applications all have a consistent IP address to connect to, and that leaves you able to swap around the databases behind it without having to change application code and redeploy. Isolating infrastructure changes from your application code. These can be as complex or as simple as you need them to be. For example, in the following diagram you see how a load balancer is paired with a high availability proxy to spread out read operations.

Load balancer plus HAProxy

If you’re interested in diving down the rabbit hole on proxying in various ways to your Cloud SQL instance, there’s a great article here to check out.

So there you have it! When something goes awry, and you need to reclaim some disk space for your Cloud SQL instance I hope this post helps. Thanks for reading! If you have any feedback or questions, please reach out to me on Twitter, my DMs are open!

Read More  Expanding The Google Cloud Ready - Sustainability Initiative With 12 New Partners

 

 

By Gabe Weiss, Developer Advocate
Source Google Cloud


For enquiries, product placements, sponsorships, and collaborations, connect with us at [email protected]. We'd love to hear from you!

Our humans need coffee too! Your support is highly appreciated, thank you!

aster.cloud

Related Topics
  • Cloud SQL
  • Database Migration Service
  • Google Cloud
  • MySQL
  • PostgreSQL
You May Also Like
View Post
  • Public Cloud

Connecting AI agents with unstructured data using Google Cloud Storage MCP Servers

  • June 10, 2026
Data center
View Post
  • Data
  • Public Cloud

Data Sovereignty in Spain. It’s Not Just About the Law, It’s About Efficiency

  • June 3, 2026
View Post
  • Data
  • Platforms
  • Public Cloud

PayPal’s historically large data migration is the foundation for its gen AI innovation

  • March 4, 2026
Google Cloud and ElevenLabs
View Post
  • Public Cloud
  • Technology

ElevenLabs Partners with Google Cloud for Cloud Services and the Latest NVIDIA Blackwell GPUs

  • February 26, 2026
View Post
  • Public Cloud

Delivering a secure, open, and sovereign digital world

  • February 12, 2026
View Post
  • Public Cloud

Formula E and Google Cloud Announce Multi-Year ‘Principal Partnership’

  • January 26, 2026
View Post
  • Public Cloud

Sawasdee Thailand! Google Cloud launches new region in Bangkok

  • January 23, 2026
View Post
  • Public Cloud

Retailers Help Mitigate Risk with Oracle’s AI-Driven Supply Chain Collaboration

  • January 11, 2026

Stay Connected!
LATEST
  • 1
    Expectations vs. Reality: The AI We Thought We’d Have in 10 Years
    • June 19, 2026
  • digital-nomad-freelancer-worker-2151205464 2
    One paperwork problem – Get your Digital Nomad Visa employment documents fast from UK, EU or Singapore
    • June 16, 2026
  • 3
    Samsung Art Store Brings Art Basel to Homes Worldwide With New Curated Collection
    • June 15, 2026
  • 4
    You Do Not Need to Invest in the IPO of SpaceX, Anthropic, and OpenAI
    • June 10, 2026
  • 5
    The consequences of relying on AI for accurate news
    • June 10, 2026
  • 6
    Connecting AI agents with unstructured data using Google Cloud Storage MCP Servers
    • June 10, 2026
  • 7
    WWDC26: Apple unveils next generation of Apple Intelligence, Siri AI, powerful parental controls, and an expansive set of software improvements
    • June 8, 2026
  • 8
    IBM and Google Cloud Announce Strategic Partnership to Scale AI with Human Expertise and AI‑Powered Delivery
    • June 4, 2026
  • Data center 9
    Data Sovereignty in Spain. It’s Not Just About the Law, It’s About Efficiency
    • June 3, 2026
  • 10
    Ink vs Pixels. What you miss versus what you are actually missing.
    • June 1, 2026
about
Hello World!

We are aster.cloud. We’re created by programmers for programmers.

Our site aims to provide guides, programming tips, reviews, and interesting materials for tech people and those who want to learn in general.

We would like to hear from you.

If you have any feedback, enquiries, or sponsorship request, kindly reach out to us at:

[email protected]
Most Popular
  • 1
    Banks race to patch new cyber vulnerabilities, and other cybersecurity news
    • May 25, 2026
  • pope-leo-xiv-cq5dam-1500.844 2
    Pope Leo XIV to Publish First Encyclical on Artificial Intelligence and Human Dignity on 25 May
    • May 22, 2026
  • 3
    Portfolio to Clients, and is Strengthened by Ongoing Project Glasswing Work
    • May 20, 2026
  • reMarkable Paper Pure 4
    Everything The reMarkable Paper Pure Actually Does
    • May 14, 2026
  • 5
    Scaling cloud and AI: Microsoft Azure’s commitment to Europe’s digital future
    • May 11, 2026
  • /
  • Technology
  • Tools
  • About
  • Contact Us

Input your search keywords and press Enter.