Documentation:
https://cloud.google.com/docs/
https://cloud.google.com/compute/docs/zones?hl=en
https://cloud.google.com/sdk/gcloud/
https://cloud.google.com/compute/docs/gcloud-compute/
Tutorials:
https://cloud.google.com/docs/tutorials
Console:
https://console.developers.google.com/
Free Trial ($300/60days):
https://cloud.google.com/free-trial/
Startup $100,000 free credit:
https://cloud.google.com/developers/startups/
Getting Started:
https://www.youtube.com/user/googlecloudplatform/videos
Pricing:
Standard machine types
Machine type | Virtual CPUs | Memory | GCEU1 | Lowest price2(USD) per hour with full sustained usage | Typical price3(USD) per hour | Full price4(USD) per hour without sustained use | Preemptible price5(USD) per hour |
---|---|---|---|---|---|---|---|
n1-standard-1 | 1 | 3.75GB | 2.75 | $0.035 | $0.038 | $0.050 | $0.015 |
n1-standard-2 | 2 | 7.5GB | 5.50 | $0.070 | $0.076 | $0.100 | $0.030 |
n1-standard-4 | 4 | 15GB | 11 | $0.140 | $0.152 | $0.200 | $0.060 |
n1-standard-8 | 8 | 30GB | 22 | $0.280 | $0.304 | $0.400 | $0.120 |
n1-standard-16 | 16 | 60GB | 44 | $0.560 | $0.608 | $0.800 | $0.240 |
n1-standard-326 | 32 | 120GB | 88 | $1.120 | $1.216 | $1.600 | $0.480 |
Custom machine type |
If your ideal machine shape is in between two predefined types, using a custom machine type could save you as much as 40%. Read more about Custom Machine Types.
|
Shared-core machine types
Machine type | Virtual CPUs | Memory | GCEU1 | Lowest price2(USD) per hour with full sustained usage | Typical price3(USD) per hour | Full price4(USD) per hour without sustained use | Preemptible price5(USD) per hour |
---|---|---|---|---|---|---|---|
f1-micro | 1 | 0.60GB | Shared CPU | $0.0056 | $0.006 | $0.008 | $0.005 |
g1-small | 1 | 1.70GB | 1.38 | $0.019 | $0.021 | $0.027 | $0.010 |
High-memory machine types
Machine type | Virtual CPUs | Memory | GCEU1 | Lowest price2(USD) per hour with full sustained usage | Typical price3(USD) per hour | Full price4(USD) per hour without sustained use | Preemptible price5(USD) per hour |
---|---|---|---|---|---|---|---|
n1-highmem-2 | 2 | 13GB | 5.50 | $0.088 | $0.096 | $0.126 | $0.035 |
n1-highmem-4 | 4 | 26GB | 11 | $0.176 | $0.192 | $0.252 | $0.070 |
n1-highmem-8 | 8 | 52GB | 22 | $0.352 | $0.384 | $0.504 | $0.140 |
n1-highmem-16 | 16 | 104GB | 44 | $0.704 | $0.768 | $1.008 | $0.280 |
n1-highmem-326 | 32 | 208GB | 88 | $1.408 | $1.536 | $2.016 | $0.560 |
Custom machine type |
If your ideal machine shape is in between two predefined types, using a custom machine type could save you as much as 40%. Read more about Custom Machine Types.
|
High-CPU machine types
Machine type | Virtual CPUs | Memory | GCEU1 | Lowest price2(USD) per hour with full sustained usage | Typical price3(USD) per hour | Full price4(USD) per hour without sustained use | Preemptible price5(USD) per hour |
---|---|---|---|---|---|---|---|
n1-highcpu-2 | 2 | 1.80GB | 5.50 | $0.053 | $0.058 | $0.076 | $0.020 |
n1-highcpu-4 | 4 | 3.60GB | 11 | $0.106 | $0.116 | $0.152 | $0.040 |
n1-highcpu-8 | 8 | 7.20GB | 22 | $0.212 | $0.232 | $0.304 | $0.080 |
n1-highcpu-16 | 16 | 14.40GB | 44 | $0.424 | $0.464 | $0.608 | $0.160 |
n1-highcpu-326 | 32 | 28.80GB | 88 | $0.848 | $0.928 | $1.216 | $0.320 |
Custom machine type |
If your ideal machine shape is in between two predefined types, using a custom machine type could save you as much as 40%. Read more about Custom Machine Type.
|
Custom machine types
Item | Price (USD) per hour | Preemptible price (USD) per hour |
---|---|---|
vCPU | $0.03492 / vCPU | $0.01002 / vCPU |
Memory | $0.00468 / GB | $0.00156 / GB |
Sustained use discounts
Usage Level (% of month) | % at which incremental is charged | Example incremental rate (USD/hour) for an n1-standard-1 instance |
---|---|---|
0%-25% | 100% of base rate | $0.050 |
25%-50% | 80% of base rate | $0.040 |
50%-75% | 60% of base rate | $0.030 |
75%-100% | 40% of base rate | $0.020 |
Comparison AWS and Google Cloud Platform:.
Service Category | Service | AWS | Google Cloud Platform |
---|---|---|---|
Compute | IaaS | Amazon Elastic Compute Cloud | Google Compute Engine |
PaaS | AWS Elastic Beanstalk | Google App Engine | |
Containers | Amazon Elastic Compute Cloud Container Service | Google Container Engine | |
Network | Load Balancer | Elastic Load Balancer | Google Cloud Load Balancing |
Peering | Direct Connect | Google Cloud Interconnect | |
DNS | Amazon Route 53 | Google Cloud DNS | |
Storage | Object Storage | Amazon Simple Storage Service | Google Cloud Storage |
Block Storage | Amazon Elastic Block Store | Google Compute Engine Persistent Disks | |
Cold Storage | Amazon Glacier | Google Cloud Storage Nearline | |
File Storage | Amazon Elastic File System | ZFS / Avere | |
Database | RDBMS | Amazon Relational Database Service | Google Cloud SQL |
NoSQL: Key-value | Amazon DynamoDB | Google Cloud Bigtable | |
NoSQL: Indexed | Amazon SimpleDB | Google Cloud Datastore | |
Big Data & Analytics | Batch Data Processing | Amazon Elastic Map Reduce | Google Cloud Dataproc, Google Cloud Dataflow |
Stream Data Processing | Amazon Kinesis | Google Cloud Dataflow | |
Stream Data Ingest | Amazon Kinesis | Google Cloud Pub/Sub | |
Analytics | Amazon Redshift | Google BigQuery | |
Application Services | Messaging | Amazon Simple Notification Service | Google Cloud Pub/Sub |
Management Services | Monitoring | Amazon CloudWatch | Stackdriver Monitoring |
Deployment | AWS CloudFormation | Google Cloud Deployment Manager |
How to guides:
https://cloud.google.com/compute/docs/how-to
Cloud Deployment Manager:
https://cloud.google.com/deployment-manager/docs/
Install google-cloud-sdk:.
https://cloud.google.com/sdk/downloads
- Download
- Extract
- ./google-cloud-sdk/install.sh
- Initialise SDK ./google-cloud-sdk/bin/gcloud init
gcloud config configurations list # List configurations
gcloud config list # List active config
gcloud config list --configuration conf1 # List config
gcloud config init # Initialise config
gcloud config configurations activate conf1 # Activate config to conf1
gcloud auth list
gcloud auth login
for p in `gcloud beta projects list | grep -v PROJECT_ID | awk ' { print $1 } ' `; do
echo "Project: $p"
gcloud config set project $p
gcloud compute instances list
echo "==============================================================="
done
echo "ACCOUNT ID ACCOUNT NAME OPEN PROJECT_ID BILLING_ENABLED"
for act in `gcloud alpha billing accounts list | awk ' { print $1 } ' | grep -v ID`; do
a=`gcloud alpha billing accounts list | grep $act`
echo $a | grep True > /dev/null
x=$?
if [ $x -eq 1 ]
then
echo $a
else
gcloud alpha billing accounts projects list $act 2>/dev/null | awk ' { printf("%-50s %s\n",$1,$3) } ' | sed "1,\$s/^/$a /" | grep -v PROJECT_ID
fi
done
gcloud auth login "ACCOUNT"
$ gcloud auth list
gcloud config set account "ACCOUNT"
gcloud compute instances list --project projectname
gcloud config set project my-project
gcloud compute instances create box1 --image coreos --zone europe-west1-c
gcloud compute instances list
gcloud compute instances list --format=json | jq '.[] | "\(.id)#\(.name)#\(.machinetype)#\(.status)#\(.zone)#\(.creationTimestamp)#\(.networkInterfaces[0].network)#\(.networkInterfaces[0].networkIP)#\(.metadata.items)"' | tr ',' ';' | tr '#' ',' | sed -e '1,$s/\"//g' -e '1,$s/\\//g'
for p in `gcloud beta projects list | grep -v PROJECT_ID | awk ' { print $1 } ' `; do echo "Project: $p"; gcloud config set project $p; gcloud compute instances list; echo "==========================================================================================================================================================="; done > allinstances.out 2>&1
gcloud compute ssh <VM-name>
gcloud compute images list
gcloud compute zones list
gcloud compute firewall-rules list
gcloud compute firewall-rules delete default-allow-rdp
gcloud compute firewall-rules create allow-http --description --allow tcp:80
# See config
gcloud config list
# Change default zone
gcloud config set compute/zone us-central1-a
# Copy a file
gcloud compute copy-files some/file.txt cloud-machine-name:~/
# Forward a port with ssh
gcloud compute ssh client-machine-name -- -L 8080:localhost:8080
echo $DEVSHELL_PROJECT_ID
=============================================================
Command reference.
=============================================================
gcloud config set compute/region <region>
echo $DEVSHELL_PROJECT_ID
mkdir ~/cpo200
echo CPO200_REGION=<region> >> ~/cpo200/config
gcloud compute zones list
echo CPO200_ZONE=<zone> >> ~/cpo200/config
source ~/cpo200/config
echo $CPO200_REGION
gcloud compute instances create guestbook-test --zone $CPO200_ZONE
gcloud compute instances create build-test --zone $CPO200_ZONE --project <build-project-id>
gcloud config list
gsutil ls -p <build-project-id>
gsutil ls -p <guestbook-project-id>
gcloud compute instances delete guestbook-test --zone $CPO200_ZONE
gcloud compute instances delete build-test --zone $CPO200_ZONE --project <build-project-id>
cd cpo200
gcloud source repos clone guestbook-container
cd guestbook-container
git pull https://github.com/GoogleCloudPlatformTraining/cpo200-guestbook-container
git push origin master
source ~/cpo200/config
gcloud compute networks list
gcloud compute networks subnets list
gcloud compute firewall-rules list
gcloud compute routes list
gcloud compute networks create jenkins-net --mode custom
gcloud compute networks describe jenkins-net
gcloud compute networks subnets create build-subnet --network jenkins-net --region $CPO200_REGION --range 192.168.5.0/24
gcloud compute firewall-rules create jenkins-net-allow-ssh --allow tcp:22 --network jenkins-net --target-tags ssh --source-ranges 0.0.0.0/0
gcloud compute firewall-rules create jenkins-net-allow-internal --allow tcp:1-65535,udp:1-65535,icmp --network jenkins-net --source-ranges 192.168.5.0/24
gcloud compute firewall-rules create jenkins-net-allow-http --allow tcp:80 --network jenkins-net --source-ranges 0.0.0.0/0 --target-tags http
gcloud compute instances create test-01 --subnet build-subnet --zone $CPO200_ZONE --tags ssh,http
gcloud compute instances create test-02 --subnet build-subnet --zone $CPO200_ZONE
ping -c 3 <test-02-external-ip-address>
ping -c 3 test-02
sudo python -m SimpleHTTPServer 80
gcloud compute instances delete test-01 test-02 --zone $CPO200_ZONE
source ~/cpo200/config
gcloud compute images list --regexp .*debian.*
gcloud compute instances create java-foundation --subnet build-subnet --zone $CPO200_ZONE --tags ssh --image debian-8-jessie-v20160629 --image-project debian-cloud --machine-type g1-small
sudo apt-get -qq update
java -version
sudo apt-get install -y -qq openjdk-7-jre
java -version
sudo apt-get install -y -qq git
gcloud compute instances stop java-foundation --zone $CPO200_ZONE
gcloud compute instances describe java-foundation --zone $CPO200_ZONE --format yaml | grep status
gcloud compute instances delete java-foundation --keep-disks boot --zone $CPO200_ZONE
gcloud compute images create debian-openjdk-java7-jre --source-disk java-foundation --source-disk-zone $CPO200_ZONE
gcloud compute images describe debian-openjdk-java7-jre --format yaml
gcloud compute instances create java-foundation-test --subnet build-subnet --zone $CPO200_ZONE --tags ssh --image debian-openjdk-java7-jre
java -version
gcloud compute disks list --zone $CPO200_ZONE
gcloud compute instances delete java-foundation-test --zone $CPO200_ZONE
gcloud compute disks list --zone $CPO200_ZONE
gcloud compute disks delete java-foundation --zone $CPO200_ZONE
REST APIs:
Get authentication token:
curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H "Metadata-Flavor: Google"
curl "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token" -H "Metadata-Flavor: Google"
Use cURL to for REST APIs with token:
curl -X GET -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" https://www.googleapis.com/compute/v1/projects/dept-ia-dev/zones/asia-east1-b/instances
curl --silent -X GET -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" https://cloudbilling.googleapis.com/v1/billingAccounts
curl -X GET -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" https://www.googleapis.com/compute/v1/projects/dept-ia-dev/zones/asia-east1-b/instances
curl --silent -X GET -H "Authorization: Bearer TOKEN" -H "Content-Type: application/json" https://cloudbilling.googleapis.com/v1/billingAccounts
echo $DEVSHELL_PROJECT_IDGoogle Cloud Networking:
IAM and Organisation Node:
Update 23/3/2016: Looks like arriving in Australia 2017 - Opening 12 new data centres:
http://www.techweekeurope.co.uk/cloud/cloud-management/google-cloud-expansion-12-new-data-centres-188443
Google’s Compute Zones may be isolated, but they’re surprisingly close together
One of the key architectural decisions of AWS is that you deploy across multiple zones in a region, but for complete redundancy, it’s a good idea to deploy across multiple regions. There have been instances where entire AWS regions have suffered outages, even though each zone is supposed to be isolated. Amazon acknowledges as much: “Although rare, failures can occur that affect the availability of instances that are in the same location.”
Compare that to Google: “Each region is completely isolated from other regions, and each zone is completely independent of other zones. If a zone or a region suffers a failure, other zones and regions won’t be affected.”
London to europe-west1-a | London to europe-west1-b | europe-west1-a to europe-west1-b |
---|---|---|
20ms | 18ms | 0.032ms |
The ping RTTs reveal that even though the ping times between west1-a and west1-b are slightly different, the internal latency is so low that it must be within the same geographical region. Light can only travel 9.5km in this short time, and given this is the round trip, the actual distance is at most half that. But if Google’s availability statement is correct, the west1-a and west1-b zones cannot be within the same physical facility. So Google must have separate data centers within Ireland, no more than a few kilometers apart.
No comments:
Post a Comment