Thursday, May 16, 2019

DataEng: GCS: List, Shutdown and Restore gcs project from gcloud



Another option I used to list, shutdown and restore Project to prevent credits from going over the limit quickly.


C:\Google\Cloud SDK>gcloud projects list
PROJECT_ID                NAME               PROJECT_NUMBER
datalab-project-1-239921  DataLab Project 1  2334346706279
C:\Google\Cloud SDK>gcloud projects delete datalab-project-1 datalab-project-1-239921


Once deleted the VM, Compute Engine and etc associated with the project will no longer be accessible. The Billing will also indicate the project no longer linked to it. The project will stay roughly 30 days before it is purged away.


The Jupyter Notebook will almost immediately throw an error.




The Billing will unlink the project.


Billing Overview should show no linked project instead of a project linked to it with charges.



Note: as of to date., there is no way to query the projects that are sitting in the "Resources pending deletion" section with gcloud command line. User will need to view that from the gcloud Console.


In order to restore, use the following command line.

C:\Google\Cloud SDK>gcloud projects undelete datalab-project-1 datalab-project-1-239921


C:\Google\Cloud SDK>gcloud projects undelete datalab-project-1-239921
Restored project [https://cloudresourcemanager.googleapis.com/v1/projects/datalab-project-1-239921].



User may still need to get back into the Console to enable/change the billing to the project then start the datalab again. These 3 steps work the same as first creating a project for Datalab.

No comments:

Post a Comment

Pandas: SQL Like pandas operations

Pandas's SQL Like operations such as WHERE clause. = != >= str.contains() & | .isin() .isnull() .notnull() ....