Вы находитесь на странице: 1из 7

244 BROUGHT TO YOU IN PARTNERSHIP WITH

Getting To Know Google CONTENTS

 What is the Google Compute Engine?

Compute Engine  What is a Project?

 Virtual Machine Features


And How To Use It  Interacting with the Compute Engine...
and more!
BY DAVID POSIN

WHAT IS THE GOOGLE COMPUTE ENGINE? A project is the main organizing unit for instances. The first step
in using Google's Compute Engine is to make a project. All
The Google Cloud Platform is a suite of product offerings instances and resources are then created in that project.
designed to bring the robust flexibility of their cloud architecture Instances and resources in a project are unique to that project,
to their customers. It is similar in nature and function to Amazon's and cannot be managed by resources in other projects. Resources
AWS and Microsoft's Azure. Google entered the cloud computing from other projects can still communicate with each other over
marketplace later than its competitors. The late entry may have standard network communication protocols but they can not be
been an initial stumbling block, but that is no longer the case. managed together.
Google has reached feature parity with its competitors. Google’s
virtual machine offering, called the Google Compute Engine, is
VIRTUAL MACHINE FEATURES
every bit as robust as an Amazon EC2 or Microsoft Azure instance.
MACHINE TYPES
Google Compute Engine is Google's Infrastructure-as-a-Service The Machine Type describes the virtual hardware attached to an
(IaaS) virtual machine offering. An IAAS platform replaces, or instance including RAM and CPUs. It also sets potential limitations
supplements, traditionally onsite network infrastructure assets, such as the maximum number of persistent disks, GPUs, and disk
like servers and routers, with cloud-based products that perform space allowed. There are two main types of machines: Predefined
the same functions. The Compute Engine allows customers to use and Custom.
powerful virtual machines in the cloud as server resources instead
of acquiring and managing server hardware. PREDEFINED MACHINE TYPES
Predefined machine types are pre-configured virtual machine
Customers can configure and run a wide variety of virtual templates that you can use to set up your virtual machine. The
machine configurations. Google provides Linux and Windows configurations have been pre-optimized by Google and meet
as operating systems for their machines, although a custom most needs. Google has broken the predefined machine types
machine option means being able to run any OS on any image into four categories that range in purpose:
you maintain. The virtual, and in some cases physical, hardware
added to the machine helps to dictate its purpose. For example,
CATEGORY PURPOSE
a web application server might need lots of RAM and CPUs
(Central Processing Units), but it does not need GPUs (Graphics Balanced between processing power and memory. Fits
Standard
Processing Units). Alternatively, a server working on modeling most common application needs
components or streaming media can use configured GPUs. A
simple website server might not need any of this, instead opting
for a medium amount of RAM and CPU power.

The Google Compute Engine feature set can meet the virtualization
requirements of any enterprise. This card serves as an introduction
to the Compute Engine and explores its main features. The card
also acts as an easy portal to many of the documentation pages
you may need when setting up a VM instance.

WHAT IS A PROJECT?

DZONE.COM | © DZONE, INC. VISIT DZONE.COM/REFCARDZ FOR MORE!


The Modern Solution to
Infrastructure Monitoring and
Troubleshooting

No complex setup. No waiting. Just answers.

Rapid7 InsightOps combines log management with IT asset search for a new
approach to infrastructure and application monitoring and troubleshooting.
It takes only minutes to setup and is free to try.

Centralize
Easily centralize data across your infrastructure, from
system logs to IT assets.

Monitor
Monitor your IT environment for anomalies, key
metrics, and critical events.

Answer
Get the answers you need, when you need them, to
resolve critical issues and maintain uptime.

Start a Free Trial


3 GETTING TO KNOW GOOGLE COMPUTE ENGINE

CATEGORY PURPOSE There are two categories of persistent disks:


Emphasis is put on memory over processing
• Shared: Standard type of disk storage with average read/
High-Memory power for tasks that need accessible non-disk storage
quickly write speeds.
• SSD: (Solid State Drive) Higher read/write speeds for
Higher CPU usage for high-intensity applications that
High-CPU instances that require improved performance.
require processing over memory
A single virtual CPU, backed by a physical CPU, that
Quick Tip: Linux operating systems are also capable of creating
can run for a period of time. These machines are not for
use cases that require an ongoing server or significant near zero latency file systems in memory called RAM disks. You
Shared-core power. The micro shared-core machine also provides can mount a RAM disk to your virtual instance for caching and
bursting capability when the virtual CPU requires more other application purposes. Mount a disk using the tmpfs disk
power than the single physical core. Bursting is for a type to create a RAM disk. For example: sudo mount -t
short, intermittent period based on need.
tmpfs -o size=25g tmpfs /mnt/ram-disk . A RAM
disk will not be backed up like a normal persistent disk, so saving
CUSTOM MACHINE TYPES
anything stored there must be done manually.
It is possible to fully configure the virtual hardware manually
for a Compute Engine VM instance. Administrators can select
LOCAL SSD
the number of virtual CPUs and memory allocated to a VM
A Local SSD is physically attached to the virtual machine running
instance within the boundaries set by Google. A certain amount
it. The SSD greatly improves performance and reduces latency.
of memory is required based on the number of virtual CPUs, and
However, the improved performance comes with a trade-off: the
vice versa. Only use a custom machine type for specific purposes
data on a local SSD only persists while the instance is running.
not meet by the predefined types.
Stopping an instance clears the data from any SSD that is
GPUS locally attached. The close connection also makes this the most
A GPU is for intensive operations that require dedicated expensive disk option.
processing units or graphics processing. This includes activities
such as computer-aided design, visual modeling, data modeling, These drives are good for cache data that is not stored for long term
machine learning, and streaming. The feature to add GPUs to a use or redundant data that can be easily rebuilt. Local SSDs cannot
Compute Engine is in beta as of June 2017. stretch across zones or be load balanced. Data is still encrypted.

Quick Tip: Instances with loaded GPUs will be forcefully CLOUD STORAGE BUCKETS
terminated during maintenance events by Google. This is The least expensive storage options are Cloud Storage Buckets.
not true of instances without GPUs which are managed There are several classes of Storage Buckets depending on the
automatically without downtime by Google. To know when a scope and level of performance needed. Some storage classes of
GPU loaded instance is going to be terminated, monitor the / Buckets can reach performance levels similar to a persistent disk,
computeMetadata/v1/instance/maintenance-event but their performance is less consistent.
endpoint from the instance. If the return value is a timestamp,
then the returned time is when the machine will be terminated. Buckets can exist globally and can be touched by multiple
instances. A persistent disk is limited to a Zone, making the
STORAGE scope of a Cloud Storage Bucket the widest ranging of all storage
PERSISTENT DISKS options. There is an added complexity to its easy accessibility,
Persistent disks are the simplest, and probably most commonly since instances can potentially overwrite each other's data. The
used, type of storage for a standard Google Compute virtual more global a class is in scope, the slower and more latent its
machine instance. They mimic the feel and functionality of any operation. In practice, the more global in scope, the more likely it
standard disk drive that you might attach to a server. In reality, is used for long-term archival and other non-mission-critical tasks.
persistent disk resources stretch your data across multiple
volumes to ensure reliability and redundancy. Cloud Storage Buckets are automatically redundant, making them
extremely reliable. The Google Compute Engine encrypts all data
Persistent disks need to be mounted onto the machine once just like the other storage options. Buckets are mountable onto a
created. Once mounted, interaction with a persistent disk feels VM's file system just like a persistent disk.
like working with a normal volume. The Compute Engine stores
the disk data independently of the instance. A persistent disk's The main difference between a bucket and a persistent disk is the
life cycle is not tied to a particular instance, making them nature of the data stored. Persistent disks are file-based storage
flexible and easily migrated. Persistent disks are also encrypted, mechanisms, while Cloud Storage Buckets are object stores. Since
and data is encrypted the moment it leaves the instance. It is they are object stores, they cannot serve as a root drive for a VM.
possible to override some of Google’s automated optimizations
of a persistent disk so that you can manage its configuration IMAGES
directly, but that is recommended only for specific purposes by Images are the software applied to your instance, including its
experienced administrators. root operating system.

DZONE.COM | © DZONE, INC. BROUGHT TO YOU IN PARTNERSHIP WITH


4 GETTING TO KNOW GOOGLE COMPUTE ENGINE

PUBLIC IMAGES numbered name and still get the most recent stable version.
Google provides a set of public images. These images are a Images are added to, deleted from, and deprecated in an image
collection of open source options and proprietary options. The family. When calling that image family, it returns the most recent
proprietary versions exist in a premium tier and incur extra costs. non-deprecated version. Rolling image versions forward or
Public images serve as a starting point for most virtual machine backward in an image family is as simple as adding a new version
instances and come packaged with only the operating system. or deprecating an existing version.
The list of public images, as of June 2017, is:
INSTANCE GROUPS
IMAGE OS PREMIUM Managing large numbers of individual virtual machines can be
cumbersome. Google helps administrators manage this potential
CentOS
workload with the use of instance groups. Administrators can
Google Container-Optimized OS manage the instances in an instance group simultaneously. There
are two types of instance groups: managed and unmanaged.
CoreOS
MANAGED
Debian
A managed instance group is made up of instances all built
Red Hat Enterprise Linux Yes from the same image template. An image template defines
SUSE Enterprise Linux Server Yes all the attributes for an instance, including which image to
use. Administrators and the Compute Engine can manage the
SLES for SAP Yes instances in bulk since all the instances are the same.
Ubuntu
This group is the most common, and the one Google suggests
Windows Server Yes administrators use. A managed instance group can automatically
scale and be used to balance server loads. Since the instances are
Google also offers an additional flavor of Windows Server with identical, the Compute Engine can bring new instances up or down
SQL Server pre-installed: to match the current traffic. The Compute Engine can also stop
unhealthy instances and replace them with new instances.
SQL SERVER VERSION
SQL Server Enterprise UNMANAGED
An unmanaged instance group is a collection of different
SQL Server Standard
instances, not based on the same image template. Management
SQL Server Web
options are limited for an unmanaged instance group since the
SQL Server Express instances are not identical. An unmanaged instance group cannot
be used for load balancing and cannot auto scale.
CUSTOM IMAGES
It is possible to use an image pre-loaded with software that more PREEMPTIBLE VM INSTANCES
closely meets your needs. The public images are a good starting Preemptible instances are a low-cost option for non-mission critical
point, but they are designed to be built upon and turned into uses. They run when the Google Compute Engine has resources
custom images. available. Alternatively, the Google Compute Engine will terminate
a preemptible instance when its resources are needed. Preemptible
Production ready environments are built on custom images. A instances are perfect for uses that can function with variable
custom image should not only have the software needed; it processing power and support variable processing times, such as
should have all the scripts necessary for the instance to work batch operations and data archival. Any task being performed by a
automatically without administrator intervention. Google can preemptible instance should be fault-tolerant.
start and stop custom images for load balancing or recovery
purposes. Preemptible instances can be part of an instance group. The
Compute Engine can terminate an instance in a group when
Quick-Tip: Metadata about an instance is stored at the it needs resources, but is highly unlikely to terminate all the
http://metadata.google.internal/computeMetadata/v1/ endpoint. instances in a group. Removing instances from the group causes
Images are spun up into instances dynamically, so anything the service to slow but not stop entirely. When resources are
that is used at runtime, such as an automation script, will need again available, the Compute Engine attempts to restore the
to retrieve instance attributes through this endpoint. For more instance group to its quota.
information, see Storing and Retrieving Instance Metadata.
There are a few things to keep in mind when using a preemptible
IMAGE FAMILIES instance:
Image families are a way to organize images so that the desired • There is no guarantee about the amount of power available
version is available without updating images and code every at any one time.
time the version is changed. Using an image family is similar • Instances are shut down in the order of most recent to
to providing an alias so that installation can use a non-version longest running. Shutting down the newest first is unlikely

DZONE.COM | © DZONE, INC. BROUGHT TO YOU IN PARTNERSHIP WITH


5 GETTING TO KNOW GOOGLE COMPUTE ENGINE

to jeopardize a long running process that may have made have no project level access, add a user's public key to the
progress in favor of a process that may have just started. project or a specific instance.
• Preemptible instances can run a maximum of 24 hours
before being terminated by the Compute Engine system. INTERACTING WITH THE COMPUTE ENGINE
• They are not covered by any SLAs since they are variable by There are several ways to interact with Compute Engine instances:
their very nature. the gcloud CLI, a REST API, and the console. The console is
• It is best to plan for system enforced termination with scripts a graphical interface that is straightforward to use, although
that can run to prepare the process for exiting. The instance encumbered by UI operations. The gcloud CLI tool is accessible
is notified 30 seconds before termination for shutdown on all Compute Engine VMs when started through the console's
scripts to run. ssh option. The gcloud tools can also be installed onto any
Compute Engine VM if you need to connect directly through SSH
REGIONS AND ZONES or some other means. Finally, there is a REST API that can be
Google Cloud resources exist in one of the three location used to manage Compute Engine VMs.
categories:
COMPUTE GROUPS
• Region: a broad geographical area. Regions are made up of
The operations that an administrator performs on a Compute
zones. Resources at the regional level are called Regional
Engine VM is broken into categories, called Groups. The Groups,
resources.
their descriptions, and links to their documentation are all
• Zone: a unit of resources that make up regions. Resources at
provided below:
the zone level are Zonal Resources.
• Global: A resource that exists in no specific region and can Quick Tip: Commands for using these groups on the command line
be used in any region. These are labeled Global resources. will be google compute [compute group]
Quick Tip: To explore/interact with the API endpoints without
The scope of a resource is constrained to its location category. For
writing code visit the Oauth 2.0 Playground
example, a zonal resource like a persistent disk can only be used
by an instance in the same zone. Meanwhile, regional resources GROUP DESCRIPTION GCLOUD API
are accessible to other regional resources and zonal resources
Type of acceleration
in that region. Resources, like images, exist globally and can be Accelerator accelerator- Accelerator
used by the GPUs that
used by a resource in any region. Types types Types
can be attached to a VM
Create, release, and list
As of June 2017, Google had the following Regions and Zones:
Addresses the addresses associat- addresses Addresses
ed with the current VM
REGION ZONES
Resource to allow for
us-central1 a group of instances,
us-east1 Autoscalers called an instance group, Autoscalers
Americas to scale based on de-
us-east4 mand automatically
us-west1 Manage Google Cloud
europe-west1 Storage buckets con-
Europe nected to the current
europe-west2
VM. Backend buckets
asia-east1 Backend are multiregional backend-
BackendBuckets
Asia asia-northeast1 Buckets highly-available storage buckets
areas. They are an excel-
asia-southeast1 lent place to store static
Australia australia-southeast1 resources for a website
or application.
ACCESS CONTROL Configures and manag-
• The only user automatically able to use a project and its es a backend service. A
backend service load
resources is the project creator. Users, servers, and external
balances a group of
integrations are connected to the project resources manually. backends, which are
• Users: user access is controlled through project roles, like instances inside a group
of instances, called an
"Compute Engine Network Admin," or primitive roles like Backend backend-
instance group, that can BackendServices
"Editor." Services services
all perform the same
• Service Accounts: Applications and resources can be given task. A backend service
knows which instance
access to each other through service accounts. Service
has how much traffic,
accounts are specific to resources and relieve developers which region it is in, and
from using user credentials for systems to talk. can maintain sessions
across backends.
• SSH Access: For users to access a VM through SSH but to

DZONE.COM | © DZONE, INC. BROUGHT TO YOU IN PARTNERSHIP WITH


6 GETTING TO KNOW GOOGLE COMPUTE ENGINE

GROUP DESCRIPTION GCLOUD API GROUP DESCRIPTION GCLOUD API


Automatically adds an Configuration settings
Instance instance- Instance
config-ssh entry for each instance config-ssh for use in launching and
Templates templates Templates
to the user's ssh file deploying new instances

connect- Allows users to connect Manage an existing Com-


connect- Instances instances Instances
to-serial- to another VM over ssh pute Engine instance
to-serial-port
port to the VM's serial port Read-only. Retrieve
informantion on the
DEPRECATED. Use scp DEPRECAT- Licenses software licenses used Licenses
copy-files
instead ED throughout Google
Retrieve the disk type Compute resources
Disk Types information about disks disk-types DiskTypes Read-only. Informa-
in the project Machine tion on the machine machine-
MachineTypes
Manage the disks in a Types types used in existing types
project including adding, instances
Disks disks Disks
removing, resizing, and Manage, and peer on,
taking snapshots Networks the networks included networks Networks
Manage the firewall in a project
Firewalls rules on a Compute firewall-rules Firewalls Mostly read, but some very
Engine VM constrained configuration
Manage the forwarding Project management, of projects.
Forwarding forwarding- project-info Projects
of traffic to a pool of ForwardingRules Information Projects are designed
Rules rules
VMs or backend services to mostly be managed
through the console.
Used for configuring
Global Global Forwarding Manipulate autoscaling
GlobalAddresses
Addresses Rules used for http load Region policies for instances in Region
balancing Autoscalers managed instance groups Autoscalers
on a regional level
Global Forwards traffic to the
Global
Forwarding load balancers for HTTP Manipulate a group of vir-
ForwardingRules Region
Rules load balancing tual machines functioning RegionBackend
Backend
Operations that have backend services on Services
Services
global implications, and regional level
are therefore imple-
Region
mented at a global level.
Instance Manage an instance RegionInstance-
Global For example, adding Global
operations Group group GroupManagers
Operations a new image. Since Operations
Managers
images can be used by
any instance in any zone, Region
Retrieve information RegionInstance-
inserting a new image is Instance
about an instance group Groups
a global operation Groups
To check the status of Get or delete an opera-
virtual machines being Region tion performed on a reg- Region
Health health-
used by a load balancer. HealthChecks Operations ular resource, such as an Operations
Checks checks
Allows for checking over IP address update
non-http connections
List Compute Engine
Manage the health Regions regions, or get informa- regions Regions
HTTP Health status of load balancer http-health- tion on a specific region
HttpHealthChecks
Checks instances, specifically checks
Reset a user's Windows
over http
password, or create
Manage the health Reset a user on a windows reset-
HTTPS
status of load balancer https-health- Windows virtual machine. Use windows-
Health HttpsHealthChecks
instances, specifically checks Password with care as it can result password
Checks
over https in lost encrypted data if
not done correctly
Manipulate the global
Images library of project vm images Images Administrate router
Routers routers Routers
images resources
Instance Control the routing
Manage the instance InstanceGroup-
Group Routes tables for Google Com- routes Routes
group entity Managers
Managers pute virtual machines
Groups of instances Copy files to and from a
Instance bundled into identifiable instance- Compute Engine virtual ma-
InstanceGroups scp scp
Groups groupings for easier groups chine. Transfer occurs over
management scp or pscp (Windows)

DZONE.COM | © DZONE, INC. BROUGHT TO YOU IN PARTNERSHIP WITH


7 GETTING TO KNOW GOOGLE COMPUTE ENGINE

GROUP DESCRIPTION GCLOUD API GROUP DESCRIPTION GCLOUD API


Manage existing per- Manipulate a project's
sistent disk snapshots, target pools. Target
Snapshots snapshots Snapshots
including deleting and pools are a collection of
Target Pools target-pools TargetPools
adding labels instances, their associ-
ated health checks, and
Use ssh to interact with fallback target pools
ssh another Compute En- ssh
Create, delete, and up-
gine virtual machime
date network ssl proxies,
Target SSL target-ssl-
which provide authenti- TargetSslProxies
Administer ssl certifi- Proxies proxies
cation and encryption to
SSL cates on a virtual ma- ssl-
SslCertificates a backend service
Certificates chine, including creation certificates
and deletion Manage tcp proxies
Target YCP for passing requests target-tcp- TargetTcp
Proxies through the network to proxies Proxies
Modify, or get informa-
Subnet- backend services
tion on, subnetworks in Subnetworks
works
a project's network Target YPN Manipulate Compute target-vpn- TargetVpn
Gateways Engine VPN gateways gateways Gateways
Manage a network's tar- Modify the mapping be-
get http proxies. Target URL Maps tween URL and backend url-maps UrlMaps
Target HTTP Http Proxies are used target- Target service
Proxies by global forwarding http-proxies HttpProxies
rules to route traffic to Manipulate Compute
Vpn Tunnels vpn-tunnels VpnTunnels
url maps. Engine VPN tunnels

Manage a network's tar- Allow for the sharing of


get https proxies. Target Google Compute's VPC
Target XPN xpn
Https Proxies are used target- Target (Virtual Private Cloud)
HTTPS across projects
by global forwarding https-proxies HttpsProxies
Proxies
rules to route traffic to Resources representing
url maps. Zone per-zone operations,
ZoneOperations
Operations such as inserting an
Create, delete, and
instance into a zone
Target get information on in- target-
TargetInstances
Instances stances designed to be instances Get information about
Zones zones Zones
terminating endpoints Google Compute zones

A B O U T T H E AU T H O R
DAVID POSIN has been involved in the Information Technology Industry for two decades. Fifteen
years of that time was spent consulting with many companies in a wide range of industries to build
solid technology stacks and robust application architectures. David has watched the Cloud and
the World Wide Web grow from their infancy, and now spends every day fully entrenched in those
worlds. Currently, David builds high-performance web applications and offers professional technical
writing services.

BROUGHT TO YOU IN PARTNERSHIP WITH

DZone communities deliver over 6 million pages each month to more than 3.3 million
software developers, architects and decision makers. DZone offers something for
everyone, including news, tutorials, cheat sheets, research guides, feature articles,
source code and more.
DZONE, INC. REFCARDZ FEEDBACK
"DZone is a developer's dream," says PC Magazine. 150 PRESTON EXECUTIVE DR. WELCOME
refcardz@dzone.com
CARY, NC 27513

Copyright © 2017 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval SPONSORSHIP
system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior 888.678.0399 OPPORTUNITIES
written permission of the publisher. 919.678.0300 sales@dzone.com

Вам также может понравиться