How to list manual snapshots in project from cloud shell
Please provide me the cloud shell command
Solved! Go to Solution.
Hi @prathik ,
Please try the following command:
gcloud compute snapshots list --filter="autoCreated != true"
Thanks for the assistance @kumards . got the expected result.
Hi,
If I understood correct, you want to list snapshots in project, right?
If yes, this command will list all snapshots under particular project.
gcloud compute snapshots list --project PROJECT_ID
i wanted to list only the manual snapshots in the project
So I'm afraid that there is no such command. We can see via UI "Creation Type" however either snapshot list or describe don't contain such informations.
Even from REST response I'm not able to find "creationType" field.
What you can do atm is label each snapshot and use --filter parameter to list only matched regex
gcloud compute snapshots list --project coe-grafana-prometeus
NAME: snapshot-1
DISK_SIZE_GB: 30
SRC_DISK: us-central1-a/disks/cka-practice
STATUS: READY
NAME: snapshot-2
DISK_SIZE_GB: 30
SRC_DISK: us-central1-a/disks/cka-practice
STATUS: READY
gcloud compute snapshots list --project coe-grafana-prometeus --filter="labels.created_manual:yes"
NAME: snapshot-1
DISK_SIZE_GB: 30
SRC_DISK: us-central1-a/disks/cka-practice
STATUS: READY
Hi @prathik ,
Please try the following command:
gcloud compute snapshots list --filter="autoCreated != true"
Thanks for the assistance @kumards . got the expected result.
Glad I was able to help, @prathik . Thanks for confirming!