Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete GCP project immediately?

We are planning for some GCP events and wanted to give each user a separate Google Cloud project to play. Billing will be charged to a single master account and after the event, all projects should be deleted to stop billing.

I didn’t want to do it manually, so I scripted it. I am using gcloud to create, assign roles and delete the projects (after the event).

gcloud  projects create $PROJECT_ID

gcloud projects delete $PROJECT_ID

With this command, projects are deleting but it is only soft delete. GCP will delete these projects after 30 days.

I am writing some cleaning scripts to delete all the resources from the project before deleting the project so that it will not cost me the 30 days charge but it's too much of work.

Is there any way to delete the GCP projects immediately?

like image 688
MR.K Avatar asked Jul 19 '18 15:07

MR.K


People also ask

How do I permanently delete a GCP project?

1 Answer. Show activity on this post. I think the best solution is to disable your billing from the projects you want to delete. So it won't be charge for the resource you didn't use, and after 30 days GCP will automatically remove the projects for you.

How do I delete everything from my GCP?

Simply go to "IAM & Admin" -> "Manage Resources". This will take you to a management screen for your projects and you can delete them, see the billing, etc.

How do I delete a project on Google BigQuery?

From the Admin console Home page, go to Reports. On the left, click BigQuery Export. Under BigQuery project ID, select the project. Click Delete.


1 Answers

According to the doc Shutting down (deleting) projects,

The project is marked for deletion ("soft deleted"), and you will lose access to it immediately, but the project can be recovered for a 30 day period. Until actual detention of the project, the project will count towards your quota usage

No, you cannot delete the GCP projects immediately. And as the docs says:

If billing is set up for a project, it might not be completely deleted until the current billing cycle ends and your account is successfully charged

I think the best solution is to disable your billing from the projects you want to delete. So it won't be charge for the resource you didn't use, and after 30 days GCP will automatically remove the projects for you. As for disable the billing, this can only be done manually.

Out of curiosity, why do you need to give each user a project to use? Any specific purposes? Why can't you just let them use the same project, and give them different roles? You can set up Custom Roles now, so you won't need to manage all these projects.

Hope this helps.


like image 180
Lee Avatar answered Oct 03 '22 08:10

Lee