Google Cloud SDK
gcloud CLI
To learn more, visit:
I'd also suggest you generate a local copy of the documentation offline.
Getting Started
Projects
Create a new project PROJECT_ID, setting it as the default for
gcloud:
gcloud projects create PROJECT_ID \
[--name PROJECT_NAME] \
--set-as-default
Set your default project to existing project PROJECT_ID
gcloud config set project PROJECT_ID
Delete the project
gcloud projects delete 'my-project'
Undelete a project
gcloud projects undelete 'my-project'
Set example as the default project
gcloud projects set project 'example'
Authenticating
If you don't have an existing account, create one
Set an existing account to be the current active account
gcloud config set account 'ttrojan@usc.edu'
Generate credentials for the client libraries (such as Python)
gcloud auth application-default login
Generate credentials for the bq command-line interface
gcloud auth login --no-launch-browser
List the name of the active account
gcloud auth list --filter=status:ACTIVE --format="value(account)"
List the name of all inactive accounts starting with tmp
gcloud auth list --filter="-status:ACTIVE account:test*" \
--format="value(account)"
Cloud DNS
SSL
Cloud SQL
Google's article Creating and managing MySQL databases covers this material pretty well, I've included some commands below
Note, the --async flag returns immediately, without waiting for the operation to complete
Creating an instance
instance_name='my_instance'
tier='db-f1-micro'
region='us-west1'
version='MYSQL_8_0'
gcloud sql instances create ${instance_name} --tier=${tier} region=${region} --database-version=${version}
Deleting an instance
instance_name='my_instance'
gcloud sql instances delete ${instance_name} --async
Creating a database
instance_name='my_instance'
database_name='my_database'
gcloud sql databases create ${database_name} --instance=${instance_name} --async
Deleting a database
instance_name='my_instance'
database_name='my_database'
gcloud sql databases delete ${database_name} --instance=${instance_name} --async
Exporting SQL data
bucket='gs://helpfulwiki'
instance_name='my_instance'
database_name='my_database'
gcloud sql export sql ${instance_name} "${bucket}/sqldata.gz" --database=${database}
I'd also take a look at Google's article about creating and managing MySQL users. If you see references to % as the host, it denotes an unrestricted host name. They wrote a good post on MySQL users as well.
Assigning a password to the root user
gcloud sql users set-password 'root' --password='root' --instance='my_instance' --host='%'
Changing the password of a regular user
gcloud sql users set-password 'username' --instance='my_instance' --host='1.2.3.4' --prompt-for-password
Enabling access via a public IP
gcloud sql instances patch 'my_instance' --assign-ip
Configuring which public IPs can access the instance
gcloud sql instances patch 'my_instance' --authorized-networks='1.2.3.4, 5.6.7.8'
Creating a user
gcloud sql users create 'username' --host='1.2.3.4' --instance='my_instance' --prompt-for-password
Listing existing users
gcloud sql users list --instance='my_instance'
Deleting a user
gcloud sql users delete atraver --host='1.2.3.4' --instance='my_instance'
Configure a user's access
Check out Google's article about connecting with MySQL Workbench, as well as their article about exporting data to a SQL dump file in Cloud Storage
Google wrote a great article about starting, stopping, and restarting instances
Cloud VPN
I'm still exploring this topic, but I found Stephanie Wong's video tutorials to be helpful in gaining more solid footing on cloud networking fundamentals.