├── 01_cloud_console └── guidance.txt ├── 02_iam ├── guidance.txt └── project_add_member.sh ├── 03_service_accounts └── guidance.txt ├── 04_cloud_sdk ├── guidance.txt └── sample_commands.txt ├── 05_stackdriver_and_billing ├── guidance.txt └── startup_script.sh ├── 06_vpc ├── deploy_vpc.sh └── guidance.txt ├── 07_loadbalancing_and_dns ├── create_private_dns_zone.sh └── guidance.txt ├── 08_gce ├── guidance.txt └── launch_instances.sh ├── 09_cloud_functions ├── deploy_function.sh ├── guidance.txt └── requirements.txt ├── 10_pd_and_cloud_storage └── guidance.txt ├── 11_load_balancer └── guidance.txt ├── 12_gae_and_gke ├── gae_deploy.txt ├── gke_deploy.txt └── guidance.txt ├── 13_deployment_mgr └── guidance.txt ├── 14_bigquery ├── billing_data_queries.txt └── guidance.txt ├── README.md └── helpful_links.txt /01_cloud_console/guidance.txt: -------------------------------------------------------------------------------- 1 | Show the building blocks list 2 | Show how to pin services 3 | Show the Cloud Shell 4 | Create a new project 5 | Explore the API enabling process 6 | -------------------------------------------------------------------------------- /02_iam/guidance.txt: -------------------------------------------------------------------------------- 1 | Explore primitive and predefined roles 2 | Create custom role 3 | #These can be done via Cloud Console or Cloud SDK 4 | Add a member to the new project 5 | Assign role to member 6 | -------------------------------------------------------------------------------- /02_iam/project_add_member.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | PROJECT=brightkey-project 4 | USER='user:arpcefxl@gmail.com' 5 | ROLE='roles/compute.admin' 6 | 7 | gcloud projects add-iam-policy-binding $PROJECT \ 8 | --member=$USER --role=$ROLE 9 | 10 | -------------------------------------------------------------------------------- /03_service_accounts/guidance.txt: -------------------------------------------------------------------------------- 1 | Create Service Account 2 | Assign role to service account 3 | Use Compute Admin for purposes of the demonstration 4 | Create key for service account 5 | This key can be used with Cloud SDK to impersonate the service account 6 | -------------------------------------------------------------------------------- /04_cloud_sdk/guidance.txt: -------------------------------------------------------------------------------- 1 | Explore Cloud SDK install steps 2 | https://cloud.google.com/sdk/docs/downloads-versioned-archives 3 | https://cloud.google.com/sdk/docs/downloads-interactive 4 | Configure Cloud SDK 5 | Explore Cloud SDK configs 6 | -------------------------------------------------------------------------------- /04_cloud_sdk/sample_commands.txt: -------------------------------------------------------------------------------- 1 | #This is a list of sample commands that can be run to test the Cloud SDK 2 | 3 | #Initialize the Cloud SDK, including ability to create new configs interactively 4 | #Can launch a browser for authentication 5 | gcloud init 6 | 7 | #List all the installed Cloud SDK components 8 | gcloud components list 9 | #Update all Cloud SDK components 10 | gcloud components update 11 | 12 | #List the configurations available, including default 13 | gcloud config list 14 | 15 | #List all available projects from the current ID 16 | gcloud projects list 17 | -------------------------------------------------------------------------------- /05_stackdriver_and_billing/guidance.txt: -------------------------------------------------------------------------------- 1 | Explore default dashboards 2 | Explore billing data 3 | Create Billing alarm 4 | Show billing data export to BigQuery 5 | Requires creation of a BigQuery table first! 6 | -------------------------------------------------------------------------------- /05_stackdriver_and_billing/startup_script.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | curl -sSO https://dl.google.com/cloudagents/install-monitoring-agent.sh 3 | sudo bash install-monitoring-agent.sh 4 | curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh 5 | sudo bash install-logging-agent.sh 6 | 7 | -------------------------------------------------------------------------------- /06_vpc/deploy_vpc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #this script takes slightly over 1 minute to run from a laptop using Cloud SDK 4 | NETWORK=demo-sdk-vpc 5 | 6 | #Create the network 7 | gcloud compute networks create $NETWORK --bgp-routing-mode=global --subnet-mode=custom 8 | 9 | #Create the subnets 10 | gcloud compute networks subnets create us-east1 --network=$NETWORK --range=10.0.1.0/24 --region us-east1 11 | gcloud compute networks subnets create us-west1 --network=$NETWORK --range=10.0.2.0/24 --region us-west1 12 | 13 | #Create firewall rules 14 | #This rule allows instances to communicate with each other on all protocols/ports 15 | gcloud compute firewall-rules create internal-all-traffic --network $NETWORK --allow tcp,udp,icmp --source-ranges 10.0.1.0/24,10.0.2.0/24 16 | #This rule allows inbound ssh on instances with an ssh tag for use with Cloud Console 17 | gcloud compute firewall-rules create inbound-ssh --network $NETWORK --allow tcp:22 --source-ranges 0.0.0.0/0 --target-tags=ssh 18 | #This rule allows inbound http traffic to instances with a tag of http-server 19 | gcloud compute firewall-rules create inbound-http --network $NETWORK --allow tcp:80 --source-ranges 0.0.0.0/0 --target-tags=http-server 20 | -------------------------------------------------------------------------------- /06_vpc/guidance.txt: -------------------------------------------------------------------------------- 1 | Explore default VPC 2 | Create Custom Mode VPC in Cloud Console 3 | Deploy Custom Mode VPC using Cloud SDK 4 | for this you can use the script, just change variable as needed! 5 | -------------------------------------------------------------------------------- /07_loadbalancing_and_dns/create_private_dns_zone.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NETWORK=demo-sdk-vpc 4 | 5 | gcloud dns managed-zones create testzone --description="this is a test zone" \ 6 | --dns-name=brightkeycloud --networks=$NETWORK --visibility=private 7 | -------------------------------------------------------------------------------- /07_loadbalancing_and_dns/guidance.txt: -------------------------------------------------------------------------------- 1 | Explore Cloud LB Dashboard 2 | Explore LB Creation Options 3 | Explore Cloud DNS Dashboard 4 | Create Private DNS Zone using script 5 | 6 | -------------------------------------------------------------------------------- /08_gce/guidance.txt: -------------------------------------------------------------------------------- 1 | Launch GCE Instance (Console) 2 | Launch GCE Instance (Cloud SDK) 3 | -------------------------------------------------------------------------------- /08_gce/launch_instances.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | gcloud beta compute --project=brightkey-project instances create us-east1 --zone=us-east1-b --machine-type=f1-micro --subnet=us-east1 --network-tier=PREMIUM --metadata=startup-script=curl\ -sSO\ https://dl.google.com/cloudagents/install-monitoring-agent.sh$'\n'sudo\ bash\ install-monitoring-agent.sh$'\n'curl\ -sSO\ https://dl.google.com/cloudagents/install-logging-agent.sh$'\n'sudo\ bash\ install-logging-agent.sh --maintenance-policy=MIGRATE --service-account=1040975251580-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --tags=ssh,http-server --image=ubuntu-1604-xenial-v20200223 --image-project=ubuntu-os-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=us-east1 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any 4 | 5 | gcloud beta compute --project=brightkey-project instances create us-west1 --zone=us-west1-b --machine-type=f1-micro --subnet=us-west1 --network-tier=PREMIUM --metadata=startup-script=curl\ -sSO\ https://dl.google.com/cloudagents/install-monitoring-agent.sh$'\n'sudo\ bash\ install-monitoring-agent.sh$'\n'curl\ -sSO\ https://dl.google.com/cloudagents/install-logging-agent.sh$'\n'sudo\ bash\ install-logging-agent.sh --maintenance-policy=MIGRATE --service-account=1040975251580-compute@developer.gserviceaccount.com --scopes=https://www.googleapis.com/auth/devstorage.read_only,https://www.googleapis.com/auth/logging.write,https://www.googleapis.com/auth/monitoring.write,https://www.googleapis.com/auth/servicecontrol,https://www.googleapis.com/auth/service.management.readonly,https://www.googleapis.com/auth/trace.append --tags=ssh,http-server --image=ubuntu-1604-xenial-v20200223 --image-project=ubuntu-os-cloud --boot-disk-size=10GB --boot-disk-type=pd-standard --boot-disk-device-name=us-west1 --no-shielded-secure-boot --shielded-vtpm --shielded-integrity-monitoring --reservation-affinity=any 6 | 7 | gcloud compute --project=brightkey-project firewall-rules create demo-sdk-vpc-allow-http --direction=INGRESS --priority=1000 --network=demo-sdk-vpc --action=ALLOW --rules=tcp:80 --source-ranges=0.0.0.0/0 --target-tags=http-server 8 | 9 | -------------------------------------------------------------------------------- /09_cloud_functions/deploy_function.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #you can follow instructions from the following page as well: 4 | #https://cloud.google.com/functions/docs/first-python 5 | 6 | #Download the function from here: 7 | #https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/functions/helloworld/main.py 8 | #or clone the entire repo: 9 | #git clone https://github.com/GoogleCloudPlatform/python-docs-samples.git 10 | 11 | #Modify the function if you want to make it unique, otherwise: 12 | #From the same directory as main.py 13 | #Create a new file requirements.txt with the following: 14 | #Flask==1.0.2 15 | 16 | #Then issue the following command: 17 | gcloud functions deploy hello_http --runtime python37 --trigger-http --allow-unauthenticated 18 | 19 | #The output of the above command will include the URL of the function, something like this: 20 | #https://us-central1-brightkey-project.cloudfunctions.net/hello_http 21 | 22 | #You can also issue a command to describe the function to locate the URL as follows: 23 | gcloud functions describe hello_http 24 | 25 | -------------------------------------------------------------------------------- /09_cloud_functions/guidance.txt: -------------------------------------------------------------------------------- 1 | Create a function from the console 2 | Deploy a function using Cloud SDK 3 | -------------------------------------------------------------------------------- /09_cloud_functions/requirements.txt: -------------------------------------------------------------------------------- 1 | Flask==1.0.2 2 | -------------------------------------------------------------------------------- /10_pd_and_cloud_storage/guidance.txt: -------------------------------------------------------------------------------- 1 | Create PD 2 | Attach PD to GCE instance 3 | Upsize PD 4 | Create bucket and explore options 5 | Explore storage transfer options 6 | -------------------------------------------------------------------------------- /11_load_balancer/guidance.txt: -------------------------------------------------------------------------------- 1 | Create unmanaged instance group 2 | Attach existing instance to unmanaged IG 3 | Finish the load balancer provisioning 4 | -------------------------------------------------------------------------------- /12_gae_and_gke/gae_deploy.txt: -------------------------------------------------------------------------------- 1 | #Pull the sample code from Git 2 | git clone https://github.com/GoogleCloudPlatform/nodejs-docs-samples 3 | 4 | #cd into the hello world app directory 5 | cd nodejs-docs-samples/appengine/hello-world/standard 6 | 7 | #build the app 8 | npm install 9 | 10 | #from the same hello-world/standard directory run the following 11 | gcloud app deploy 12 | 13 | -------------------------------------------------------------------------------- /12_gae_and_gke/gke_deploy.txt: -------------------------------------------------------------------------------- 1 | #Make sure you have the zone set in gcloud config 2 | gcloud config set compute/zone compute-zone 3 | 4 | #create a small cluster with one GCE node 5 | gcloud container clusters create helloworld-cluster --num-nodes=1 6 | 7 | #extract credentials to work with the cluster via kubectl 8 | gcloud container clusters get-credentials helloworld-cluster 9 | 10 | #Deploy a hello world application to the newly launched cluster 11 | kubectl create deployment helloworld-app --image=gcr.io/google-samples/hello-app:1.0 12 | 13 | #Expose the application to the world on port 80 14 | kubectl expose deployment helloworld-app --type LoadBalancer --port 80 --target-port 8080 15 | 16 | #Check the resources and get the public IP information 17 | kubectl get pods 18 | kubectl get service helloworld-app 19 | 20 | #Clean up resources afterward 21 | kubectl delete service helloworld-app 22 | gcloud container clusters delete helloworld-cluster-app 23 | -------------------------------------------------------------------------------- /12_gae_and_gke/guidance.txt: -------------------------------------------------------------------------------- 1 | Deploy GAE Standard app (Cloud SDK) 2 | Deploy GKE Cluster (Cloud SDK) 3 | -------------------------------------------------------------------------------- /13_deployment_mgr/guidance.txt: -------------------------------------------------------------------------------- 1 | #Clone the Google-supplied repo for Deployment Manager examples 2 | git clone https://github.com/GoogleCloudPlatform/deploymentmanager-samples.git 3 | 4 | #cd into the directory for launching a single vm 5 | cd deploymentmanager-samples/examples/v2/single_vm/python 6 | 7 | #edit the yaml template and set the zone parameter to your preference 8 | 9 | #to test the template without actually deploying resources execute the below command 10 | #make sure the output looks something like the following: 11 | #MacBook-Pro-2:python csmith$ gcloud deployment-manager deployments create single-vm --config vm.yaml --preview 12 | #The fingerprint of the deployment is MezSNiacs7or0qZGjdJJjw== 13 | #Waiting for create [operation-1583902211111-5a08cf8a6fb12-bcae1efd-5bebc0c2]...done. 14 | #Create operation operation-1583902211111-5a08cf8a6fb12-bcae1efd-5bebc0c2 completed successfully. 15 | #NAME TYPE STATE ERRORS INTENT 16 | #datadisk-single-vm compute.v1.disk IN_PREVIEW [] CREATE_OR_ACQUIRE 17 | #vm-single-vm compute.v1.instance IN_PREVIEW [] CREATE_OR_ACQUIRE 18 | gcloud deployment-manager deployments create single-vm --config vm.yaml --preview 19 | 20 | #to fully deploy the resources 21 | gcloud deployment-manager deployments update single-vm 22 | #verify resource were deployed (using Cloud Console or Cloud SDK) 23 | 24 | #to delete the deployment 25 | gcloud deployment-manager deployments delete single-vm 26 | -------------------------------------------------------------------------------- /14_bigquery/billing_data_queries.txt: -------------------------------------------------------------------------------- 1 | #The following will query your invoice total, per month: 2 | #These use my own table data, modify to match your project and table name! 3 | SELECT 4 | invoice.month, 5 | SUM(cost) 6 | + SUM(IFNULL((SELECT SUM(c.amount) 7 | FROM UNNEST(credits) c), 0)) 8 | AS total, 9 | (SUM(CAST(cost * 1000000 AS int64)) 10 | + SUM(IFNULL((SELECT SUM(CAST(c.amount * 1000000 as int64)) 11 | FROM UNNEST(credits) c), 0))) / 1000000 12 | AS total_exact 13 | FROM `billing_export.gcp_billing_export_v1_00C400_E75F97_77D597` 14 | GROUP BY 1 15 | ORDER BY 1 ASC 16 | ; 17 | 18 | #Granular cost data - be prepared for a lot of output 19 | SELECT 20 | sku.description, 21 | TO_JSON_STRING(labels) as labels, 22 | cost as cost 23 | FROM `billing_export.gcp_billing_export_v1_00C400_E75F97_77D597`; 24 | 25 | #Organize billing data by label 26 | SELECT 27 | TO_JSON_STRING(labels) as labels, 28 | sum(cost) as cost 29 | FROM `billing_export.gcp_billing_export_v1_00C400_E75F97_77D597` 30 | GROUP BY labels; 31 | 32 | -------------------------------------------------------------------------------- /14_bigquery/guidance.txt: -------------------------------------------------------------------------------- 1 | Explore billing data using BigQuery SQL examples 2 | Configure audit log sink to BigQuery 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # getting-started-with-gcp 2 | Getting Started with Google Cloud Platform links and scripts 3 | -------------------------------------------------------------------------------- /helpful_links.txt: -------------------------------------------------------------------------------- 1 | #All GCP Services 2 | https://cloud.google.com/products 3 | 4 | #GCP Free Tier 5 | https://cloud.google.com/free 6 | 7 | #Global fiber and infrastructure 8 | https://cloud.google.com/about/locations/#network 9 | https://cloud.google.com/about/locations/#regions 10 | 11 | #Best Practices 12 | https://cloud.google.com/docs/enterprise/best-practices-for-enterprise-organizations 13 | 14 | #Cloud Console link 15 | https://console.cloud.google.com/ 16 | 17 | #Cloud IAM Roles 18 | https://cloud.google.com/iam/docs/understanding-roles 19 | 20 | #Service Accounts 21 | https://cloud.google.com/iam/docs/service-accounts 22 | 23 | #Cloud SDK 24 | https://cloud.google.com/sdk/ 25 | 26 | #Billing details and export examples 27 | https://cloud.google.com/billing/docs/how-to 28 | 29 | #VPC Overview 30 | https://cloud.google.com/vpc/docs/vpc 31 | 32 | #Hybrid Network design patterns 33 | https://cloud.google.com/solutions/hybrid-and-multi-cloud-network-topologies 34 | 35 | #Load Balancing documentation 36 | https://cloud.google.com/load-balancing/docs/load-balancing-overview 37 | 38 | #Pricing Calculator 39 | https://cloud.google.com/products/calculator 40 | 41 | #GCE Machine Types 42 | https://cloud.google.com/compute/docs/machine-types 43 | 44 | #GCE Pricing - IMPORTANT! 45 | https://cloud.google.com/compute/all-pricing 46 | 47 | #Deploying a Cloud Function from the Cloud SDK 48 | https://cloud.google.com/functions/docs/how-to 49 | 50 | #Quick comparison of storage options from Local SSD to Cloud Storage 51 | https://cloud.google.com/compute/docs/disks 52 | 53 | #Comparison of Cloud Storage classes 54 | https://cloud.google.com/storage/docs/storage-classes 55 | 56 | #Explanation of Cloud Storage location types 57 | https://cloud.google.com/storage/docs/locations 58 | 59 | #Cloud SQL features and engine types 60 | https://cloud.google.com/sql/docs/features 61 | 62 | #Spanner is a unique service, here are some whitepapers! 63 | https://cloud.google.com/spanner/docs/whitepapers 64 | 65 | #Explanation of Instance Groups (managed and unmanaged) 66 | https://cloud.google.com/compute/docs/instance-groups 67 | 68 | #Deploy an auto-scaled web application 69 | https://cloud.google.com/compute/docs/tutorials/high-scalability-autoscaling 70 | 71 | #Deploy a sample Node.js application using App Engine 72 | https://cloud.google.com/appengine/docs/standard/nodejs/quickstart 73 | 74 | #Cloud SDK scripting primer 75 | https://cloud.google.com/sdk/docs/scripting-gcloud 76 | 77 | #Differences between BigTable and HBase 78 | https://cloud.google.com/bigtable/docs/hbase-differences 79 | 80 | #BigTable performance 81 | https://cloud.google.com/bigtable/docs/performance 82 | 83 | #Inter-Region Latency dashboard 84 | https://datastudio.google.com/u/0/reporting/fc733b10-9744-4a72-a502-92290f608571/page/70YCB 85 | --------------------------------------------------------------------------------