10 GCP gcloud Commands I Use Every Day
Here are 10 useful gcloud commands that you might use daily when working with Google Cloud Platform (GCP) to manage resources, monitor operations, and configure your environment efficiently.
1. Set the Default Project
Set the default project to avoid specifying it in every command.
gcloud config set project PROJECT_ID
2. List Active Projects
Quickly view all available projects and their statuses.
gcloud projects list
3. Authenticate and Login
Authenticate your Google Cloud account to access resources.
gcloud auth login
4. Start and Stop a Compute Engine VM
Start or stop a Compute Engine virtual machine by its instance name.
# Start a VM instance
gcloud compute instances start INSTANCE_NAME --zone ZONE_NAME
# Stop a VM instance
gcloud compute instances stop INSTANCE_NAME --zone ZONE_NAME
5. SSH Into a Compute Engine VM
Easily SSH into a Compute Engine instance.
gcloud compute ssh INSTANCE_NAME --zone ZONE_NAME
6. Create a New Storage Bucket
Create a new Google Cloud Storage bucket in a specified region.
gcloud storage buckets create gs://BUCKET_NAME --location=REGION_NAME
7. List Compute Engine Instances
List all Compute Engine instances in a specific project and region.
gcloud compute instances list --filter="zone:(ZONE_NAME)"
8. Deploy an App Using App Engine
Deploy an application to Google App Engine.
gcloud app deploy
9. View Logs Using GCP Logging
Access the logs from a specific project, filtering by a specific resource (e.g., Cloud Functions).
gcloud logging read "resource.type=cloud_function" --limit 50
10. Check Billing Info for the Current Project
View detailed billing information and costs associated with a project.
gcloud alpha billing projects describe PROJECT_ID
These gcloud commands cover typical daily tasks such as managing VMs, interacting with storage, handling authentication, and monitoring services. They are designed to help streamline your workflow and efficiently manage GCP resources.
AI Training Data | NLP | Prompt Engineering | Multilingual Speech-to-Text Transcription | Chatbot | Conversational AI | Machine translation | Human in the loop AI integration
1 个月Yugandhara, Very interesting, thanks for sharing!