Delete a Cloud SQL instance without deleting your application. Deleting the application doesn't delete the instance by default.
Enable cascading deletion ΒΆ
Set cascadingDelete to true on the instance in your application manifest:
app.yaml
spec:
gcp:
sqlInstances:
- type: POSTGRES_17
cascadingDelete: true
databases:
- name: mydbDeploy your application with the instance still in the manifest. Wait for the deployment to succeed before removing the instance.
Remove the instance from the manifest ΒΆ
Remove sqlInstances from spec.gcp. Keep any other settings under gcp. If none remain, remove gcp too, as shown below:
app.yaml
spec:
- gcp:
- sqlInstances:
- - type: POSTGRES_17
- cascadingDelete: true
- databases:
- - name: mydbDeploy your application again. Nais deletes the instance after the deployment.
Verify deletion ΒΆ
- Open Nais Console and select your team.
- Select Cloud SQL.
- Check that the instance no longer appears in the list for its environment.
List the Cloud SQL instances for your team and environment:
bash
nais cloudsql list --team <TEAM> --environment <ENVIRONMENT>Check that the instance no longer appears in the output.