Cloud SQL instances are occasionally placed in maintenance mode by Google automatically for updates or other necessary tasks. During maintenance, instances cannot be deleted.
Another possibility is that the instance is in a state that prevents it from being deleted, such as the running state.
To check the state of your Cloud SQL instance, you can use the following command:
gcloud sql instances describe <instance_name>
This command will display the state of the instance, as well as any other relevant information.
If the instance is under maintenance, you will need to wait until maintenance is complete before you can delete it. If the instance is in a state that prevents it from being deleted, you will need to take steps to change the state of the instance before you can delete it.
Here are some additional things you can try to resolve the issue:
Wait for at least 10-15 minutes and try again.
Check the Cloud SQL API documentation for more information about the error message you are receiving.
We tried connecting to this instance a couple of time but had the same error message. The issue started last August 21 of this year and this instance was always in Maintenance status.
Based on the output of the gcloud sql instances describe command, the instance croc-prod-repl-slave-2 is currently in the MAINTENANCE state. This means that it is undergoing maintenance and cannot be accessed.
The reasons for maintenance can vary, including:
Updating to a newer version of MySQL.
Patching for security vulnerabilities.
Reconfigurations.
Maintenance typically completes within a few hours, but the duration can vary depending on the nature of the maintenance. If it extends beyond the expected duration, you can consider reaching out to Google Cloud support.
In the meantime, you can attempt to connect to the master instance of the replication group, croc-prod-repl-slave-2-master. As the primary instance in the replication group, it should be accessible:
Once connected to the master instance, you can perform necessary operations. However, be cautious and ensure you have recent backups before making significant changes, as these will be replicated to the replicas once they are back online.
After the maintenance on the replica instance croc-prod-repl-slave-2 is complete, you should regain access.