For terminal access to your machines,
EC2 requires you to create and include your SSH key.
In compute engine you can create the key if you want or you can use
a project-wide key that's created automatically for all instances.
There are two easy ways to SSH to your machines from within
the cloud console: you can SSH directly to your machine
from within the console interface or you can open
a command shell from within the console called Cloud Shell and SSH from there.
When you do this, you don't need to store the key locally, it's passed for you.
You can also RDP to Microsoft machines from within cloud console.
For more details on using cloud shell, see the link.
Every instance stores its meta data on a meta data server.
You can query the server programmatically from
within the instance or startup and shutdown scripts.
This way you can get unique information about the instance,
such as hostname or ID,
and use it to set up, say, a database.
There are both default and custom entries.
To query values, you send a URL request with root URL,
meta data key name and a special header.
Here's an example of how to get the hostname.
For more information on metadata server, see the link.
You can create and configure cloud platform resources by console,
gcloud (a command-line tool), API,
or deployment manager, which allows you to specify resources declaratively in templates.
Gcloud is automatically installed in Cloud Shell so you can access it from there.
In the demo we'll use both console and Gcloud.
For more details on these tools,
see the following link.
In addition to standard pricing,
GCE and EC2 offer discounts for temporary or sustained-use instances.
Temporary instances become available when resources are
not fully utilized and can be reclaimed at any time.
Compute engine calls them preemptable VMs.
EC2 calls them spot instances.
They're functionally similar but have significantly different cost models.
Spot instances are primarily auctioned and bid upon at fluctuating market rates.
You have to watch for deals,
bid, and wait to see if you get the instances.
Preemptable VMs, on the other hand,
have fixed discounts up to 80 percent based on
machine type and run for a maximum of 24 hours.
The benefit of this model is simplicity and predictability.
It's worth noting that EC2 has also started a service like this.
Sustained-use discounts are offered for using machines continuously.
EC2 calls them reserved instances and require you to commit to use for a period upfront.
GCE does not apply your discount automatically as you go.
Overall, key GCE differences include: faster instance spin-ups,
which are especially helpful when spinning up many VMs;
instance billing per minute instead of per hour;
custom machine types with specific amounts of CPU and RAM;
automatic sustained use discounts without advanced reservations.
Here is a list of key GCP terms and AWS equivalents.
Now, let's spin up an instance and deploy an application on it.