Google Cloud Platform (GCP) is a suite of cloud computing services that runs on the same infrastructure that Google uses internally for its end-user products, such as Google Search, Gmail, Google Drive, and YouTube.
The GCP Console is a web-based interface to manage your Google Cloud resources.
Accessing the Console:
Console Organization:
Creating a New Project:
The gcloud CLI is a command-line tool for managing GCP resources.
Installation: Follow the instructions at: https://cloud.google.com/sdk/docs/install
Initialize gcloud:
gcloud init
Basic Command Structure:
gcloud <service> <group> <command> <flags>
Example Commands:
gcloud compute instances list
gcloud storage buckets list
gcloud projects list
Compute Engine lets you create and run virtual machines on Google infrastructure.
Create a VM Instance:
gcloud compute instances create my-vm --zone=us-central1-a --machine-type=e2-medium --image-project=debian-cloud --image-family=debian-10
List VM Instances:
gcloud compute instances list
SSH into a VM:
gcloud compute ssh my-vm --zone=us-central1-a
Stop a VM:
gcloud compute instances stop my-vm --zone=us-central1-a
Delete a VM:
gcloud compute instances delete my-vm --zone=us-central1-a
Cloud Storage is GCP's object storage service.
Create a Bucket:
gcloud storage buckets create gs://my-bucket
Upload a File:
gcloud storage cp myfile.txt gs://my-bucket/
List Bucket Contents:
gcloud storage ls gs://my-bucket
Download a File:
gcloud storage cp gs://my-bucket/myfile.txt ./
Delete a File:
gcloud storage rm gs://my-bucket/myfile.txt
Cloud Identity and Access Management (IAM) lets you manage access control by defining who (identity) has what access (role) for which resource.
List IAM Policies:
gcloud projects get-iam-policy PROJECT_ID
Add IAM Policy Binding:
gcloud projects add-iam-policy-binding PROJECT_ID --member=user:email@example.com --role=roles/editor
Remove IAM Policy Binding:
gcloud projects remove-iam-policy-binding PROJECT_ID --member=user:email@example.com --role=roles/editor
Create a Service Account:
gcloud iam service-accounts create my-sa-name --display-name "My Service Account"
Cloud SQL is a fully-managed database service that makes it easy to set up, maintain, manage, and administer your relational databases on Google Cloud Platform.
Create a Cloud SQL Instance:
gcloud sql instances create my-instance --tier=db-n1-standard-1 --region=us-central1
List Cloud SQL Instances:
gcloud sql instances list
Create a Database:
gcloud sql databases create my-database --instance=my-instance
Create a User:
gcloud sql users create my-user --instance=my-instance --password=my-password
Cloud Functions is GCP's serverless compute platform.
Deploy a Function:
gcloud functions deploy my-function --runtime python37 --trigger-http --entry-point function_name
List Functions:
gcloud functions list
Describe a Function:
gcloud functions describe my-function
Delete a Function:
gcloud functions delete my-function
Deployment Manager is an infrastructure deployment service that automates the creation and management of Google Cloud resources.
Create a Deployment:
gcloud deployment-manager deployments create my-deployment --config my-config.yaml
List Deployments:
gcloud deployment-manager deployments list
Update a Deployment:
gcloud deployment-manager deployments update my-deployment --config my-updated-config.yaml
Delete a Deployment:
gcloud deployment-manager deployments delete my-deployment
VPC provides networking functionality to Compute Engine virtual machine (VM) instances, Kubernetes Engine containers, and App Engine flexible environment.
Create a VPC Network:
gcloud compute networks create my-vpc --subnet-mode=custom
Create a Subnet:
gcloud compute networks subnets create my-subnet --network=my-vpc --region=us-central1 --range=10.0.0.0/24
Create a Firewall Rule:
gcloud compute firewall-rules create my-rule --network=my-vpc --allow tcp:22,tcp:80,tcp:443
List VPC Networks:
gcloud compute networks list
Cloud Monitoring provides visibility into the performance, uptime, and overall health of cloud-powered applications.
Create a Monitoring Workspace:
gcloud monitoring workspaces create --project=PROJECT_ID
List Metrics:
gcloud monitoring metrics list
Create an Alert Policy:
gcloud monitoring policies create --display-name="My Alert Policy" --condition="metric.type="compute.googleapis.com/instance/cpu/utilization" AND resource.type="gce_instance" AND metric.labels.instance_name="my-instance"" --threshold-value=0.8 --duration=5m
List Alert Policies:
gcloud monitoring policies list
2024 © All rights reserved - buraxta.com