Googlecloudplatform 1151921572881138355
Googlecloudplatform 1151921572881138355
Certification Prep
Google Cloud Certifications
asdfCloud
Google
Associate Professional
Certifications Certifications
Month/Year
Resource Hierarchy Components
Organization
Folders
Resources Labels
Organization
• Top of resource hierarchy
• Contains projects and folders
• Identities come from G Suite or a Cloud Identity account
• IAM policies are inherited down into projects and resources
• Central control for all resources
• Projects belong to the organization, not employees
• Can grant organization level roles
Folders
• Grouping mechanism within an organization
• Logical group of projects
• Can set IAM policies to administer multiple projects
• Model legal entities, departments, and teams
Projects
• Container for billable resources
• Some resources can be used for free
• For all others, billing account needs to be linked
• Required resource for using GCP services
Resources
• Any component that incurs billing
• Must exist within project
• Can set resource-level IAM
• Inherits policies from organization, folder, project
• Lowest level of the hierarchy
Labels
• Key-value pairs
• Resource metadata
• Can use to organize billing
• Can break down billing by label
Using GCP Resources
Compute Storage
Where is code executed and how? Where is data stored?
Networking, hosting, logging, are choices
made after this fundamental decision
App:Hello
Compute Choices
IaaS PaaS
Google Compute Engine (GCE)
Bare Metal vs. IaaS
Bare Metal IaaS
• Apps run on OS which runs on • Hypervisor between apps and
hardware hardware
• Less portable • More portable
• CPUs • vCPUs
• Full burden of ops and admin • Much of ops burden managed by
service provider
GCP Internals
Predefined Custom
Public Custom
Base Images
Public Custom
Public Custom
Public Custom
Managed Instance
GCE VM Instances Load Balancers
Groups
Accessing Storage from VMs
RAM disk
HDD SSD
Persistent Disks vs. Buckets
Persistent Disks Buckets
• Block storage • Object storage
• Max 64TB in size • Infinitely scalable
• Pay what you allocate • Pay what you use
• Tied to GCE VMs • Independent of GCE VMs
• Zonal (or regional) access • Global access
Persistent Disks
• Resize on the fly
• Move across zones
• Create images and snapshots
• Encrypted at rest
• can use custom keys
Boot Disk
• Each GCE VM needs a persistent boot disk
• This disk contains boot loader, OS etc.
• Bootable
• Durable
• can delete VM but keep disk
Persistent Disks vs. Local SSDs
Persistent Disks Local SSDs
• Network-attached storage • Physically attached to instance
• Data redundancy built-in • No data redundancy built-in
• Bootable • Not bootable
• Durable • Not durable
• HDD or SSD • SSD for better performance
• 64TB max • 3TB max
• Create snapshots or images • Can not create snapshots or
• Relatively slow images
• Very fast, especially for random
access
Availability Policies
A VM instance's availability policy determines how it behaves
when an event occurs that requires Google to move your VM to a
different host machine
Availability Policies
Support for Go, PHP, Java, Python, Node.js, .NET, Ruby and
other languages
App Engine Environments
Service Service
Month/Year
Cloud Functions
Event-driven serverless compute platform
Event-driven Serverless Compute
Cloud
Platform triggers Invokes other
Event occurs Function
execution GCP services
code runs
Types of Events
HTTP Background
Cloud Storage
Pub/Sub Firebase
Stackdriver
Logging
Concurrency and Scale
• Spin up function instances based on current load
• Functions do not share memory or variables
• An instance processes a single request
• Functions should be stateless
Session 3: Storage
Storage Technologies
OLTP OLAP
Physically addressable
storage accessed from
compute
Unstructured Data
Logically addressable
storage accessed from
compute or by human users
Persistent Disks vs. Buckets
Persistent Disks Buckets
• Block storage • Object storage
• Max 64TB in size • Infinitely scalable
• Pay what you allocate • Pay what you use
• Tied to GCE VMs • Independent of GCE VMs
• Zonal (or regional) access • Global access
GCS Storage Classes
How often is a data item accessed?
Storage Costs
Different storage classes
Retrieval Costs represent different trade-offs
Use Cases
Availability
Use Cases
Availability
Storage Cost
Storage Class
Storage Costs (cents/GB/month)
Access Frequency
Use Cases
Availability
Retrieval Cost
Storage Class
Storage Costs (cents/GB)
Standard None
Retrieval Costs
Nearline 1.0
Access Frequency
Use Cases
Availability
Minimum
Storage Class
Storage Costs Commitment
Standard None
Retrieval Costs
Nearline 30 days*
Access Frequency
Use Cases
*Early deletion will incur charges
Availability
Access Frequency
Use Cases
“11 nines”
Availability
Access Frequency
Use Cases
Availability
Storage Class Access Frequency
Block storage Persistent disks or local SSDs AWS EBS, Azure Disk
Object/blob storage Cloud Storage (GCS) buckets AWS S3, Azure Blob Storage
asia-south1
us-east1
Subnets in Each Region
Subnets
Project
asia-south1
us-east1
Resources Provisioned on
Subnets
Project
asia-south1
us-east1
Subnets
• IP range partitions within global VPCs
• VPCs have no IP ranges
• Subnets are regional - can span zones inside a region
• Network has to have at least one subnet before you can use it
Subnets
• Auto Mode VPCs have pre-created subnets
• One in each GCP region
• Custom Mode VPCs start with no subnets
• Full control over which regions have subnets
• Can create multiple subnets in a region
Subnets and IP Ranges
• Each subnet must have primary address range
• Valid RFC 1918 CIDR block
• Subnet ranges in same network cannot overlap
• Subnet ranges in different networks can overlap
Communication on VPCs
Project
asia-south1
us-east1
asia-south1
us-east1
asia-south1
us-east1
asia-south1
Default VPC1
\ VPC2
VPC
us-east1
Even though they are in the same region - they may even be
in the same zone on the same physical hardware
Default VPC
Default VPC
• Pre-created on every project
• Includes subnet for each GCP region
• New subnets added when new regions are created
• Resources created here by default
Default VPC
• Includes routes for all resources
• All VMs on the default VPC can talk to each other
• Default gateway to internet
• Includes several firewall rules
Firewall Rules
• Every VPC is a distributed firewall
• Firewall rules defined in VPC
• Are applied on per-instance basis
• Can also regulate internal traffic
Firewall Rules
• Every VPC has two permanent rules
• Implied allow egress
• Implied deny ingress
• Can be overridden by more specific rules
• In addition, default VPC has several rules
Additional Rules in Default VPC
• default-allow-internal
• default-allow-ssh
• default-allow-rdp
• default-allow-icmp
VPCs on the Google Cloud
Internal External
Destinations
• Any IP (0.0.0.0/0)
• Destination IP ranges
Protocol and Port
• If both omitted - rule applies to all traffic
• Protocol can be name or decimal number
• If port omitted, applies to all ports
• Can specify combinations
• tcp:80
• tcp:20-22
• tcp:80; tcp:443
Connecting Networks
Month/Year
Shared VPC
• Share VPC across projects on GCP
• Projects must be in the same organization
• Host project, guest resources
• Shared VPC admin to administer the shared VPC
VPC Peering
• Share VPC across projects on GCP
• Projects need not be in the same organization
• Allows resources on different VPC network to communicate
using private IP addresses
• Reduced latency, higher security and lower cost as compared
with using external IPs
Shared VPCs vs. Network Peering
Shared VPCs Network Peering
• Only within same organization • Across organization boundaries
• One VPC used across projects • Multiple VPCs share resources
• Host and service projects are • Connected VPCs are peers
not peers
• Only single level of sharing • Multiple levels of peering possible
possible
Interconnecting Networks
Enterprise connectivity
GCP-to-GCP
Peering and interconnect
VPC Network Peering
options
Enterprise Connectivity
Internal IP Public IP
Addresses Addresses
SLA No SLA
Interconnect Peering
Enterprise Connectivity
Interconnect Peering
Interconnect Peering
Internal IP addresses in
RFC 1918 address space
With SLA
VPN Tunnel
Configuration Property Choice
Individual Service
Groups
Users Accounts
GCP Identities
• Member types:
• Google accounts
• Service accounts
• Google groups
• G Suite domains
• Cloud Identity domains
Google account
A Google account represents a developer, an administrator, or
any other person who interacts with GCP.
Service account
A service account is an account that belongs to your application
instead of to an individual end user.
Google Group
A Google Group is a named collection of Google accounts and
service accounts. Every group has a unique email address that is
associated with the group.
G Suite domain
A G Suite domain represents a virtual group of all the Google
accounts that have been created in an organization’s G
Suite account. G Suite domains represent your organization's
Internet domain name.
Cloud Identity domain
A Cloud Identity domain is like a G Suite domain because it
represents a virtual group of all Google accounts in an
organization. However, Cloud Identity domain users don't have
access to G Suite applications and features.
allAuthenticatedUsers
Special identifier that represents anyone who is authenticated with
a Google account or a service account.
allUsers
Special identifier that represents anyone who is on the internet,
including authenticated and unauthenticated users.
Service account
A service account is an account that belongs to your application
instead of to an individual end user.
Individual Service
Groups RBAC ACLs
Users Accounts
All viewer permissions, plus permissions for actions that modify state,
roles/editor Editor
such as changing existing resources
Individual Service
Groups RBAC ACLs
Users Accounts
Symmetric Asymmetric
Both encryption and decryption are Have a public/private: key pair one
performed using the same key for encryption, one for decryption
Three Purposes of Keys
Worker
nodes
Master node
Master
• One or more nodes designated master node
• Unified endpoint for your cluster
• Managed by GKE, not visible directly to user
• Multi-master for high-availability
• Pulls container images from the GCR for cluster nodes
• Kubernetes Control Plane directed from here
Kubernetes Clusters
Containers run
on worker nodes
Simply use the web console or the gcloud command line utility
Pods on Kubernetes Nodes
• Smallest and most basic deployable object in Kubernetes
• Can not run a container without enclosing pod
• Pods provide isolation between containers
• Pod acts as sandbox for enclosed containers
• Multi-container pods are possible
• tightly-coupled
• not usually recommended
Higher-level Abstractions
• ReplicaSet
• Scaling and healing
• Deployment
• Versioning and rollback
• Service
• Static (non-ephemeral) IP addresses
• Stable networking
• Persistent volumes
• Non-ephemeral storage
ReplicaSet
• If pod crashes, ReplicaSet will start a new one
• Key to scaling and healing
• All pods are replicas of each other
Deployment Objects
• Easy to push out new version of container
• Triggers creation of new ReplicaSet and new containers
• Pods in old ReplicaSet gradually reduced to zero
• Every change to a Deployment object triggers creation of a new
revision
• Trivial to rollback to previous revision
• Offers versioning support
Ephemeral IP Addresses
• Containers expose ports in pod spec
• Pod IP addresses are ephemeral
• Where should clients send requests?
Service Objects
• Provides stable (non-ephemeral) IP address
• Connects to set of back-end pods
• Set of pods changes dynamically
• Basic load balancing too
Storage with Containers
• On disk files within a container
• Only accessible to the container itself
• Ephemeral: is lost when the container stops or crashes
• Volume abstractions
• A directory accessible to all containers in a pod
• Have the same lifetime as the enclosing pod
For durable storage use
persistent volumes
The volume is preserved even when the pod is
removed and can be handed off to another pod
Workloads on Kubernetes
To deploy and manage containerized applications on the GKE the
Kubernetes system creates controller objects
Workloads on Kubernetes
• Stateless applications
• Does not preserve state, saves no data to persistent disk
• Deployed using the Deployment object
• Stateful applications
• State is saved or persisted, uses persistent volumes
• Deployed using the StatefulSet object
• Batch jobs
• Finite, independent, parallel jobs
• Deployed using the Job object
• Daemons
• Ongoing, background tasks, without intervention
• Deployed using a DaemonSet
Session 7: Load Balancing
Scalable Compute
External Internal
Regional
Global Regional
Network
TCP/UDP
HTTP/
SSL Proxy TCP Proxy
HTTPS
OSI Network Stack
User
Physical Layer
Instance Group
Health Check
Url Map
HTTP(S)
Backend
End user A Cloud CDN Load
Instance
Balancer
The Cloud CDN will try and deliver content from the
cache if content is present in the cache
Month/Year
Cloud VM Instances
• The easiest compute option to begin with
• “Lift-and-shift” migration from on-premise data center
• However, two significant drawbacks
Individual VMs do not provide autoscaling
and autohealing
Cloud VM Instances
• Individual VM instances do not provide either advantage
• Some higher level abstraction is needed to do so
Managed Instance Groups are a horizontally scaled
IaaS offering with autohealing and autoscaling
Managed Instance Group
Group of identical GCE VM instances, created from the same
instance template that are managed by the platform
Instance Template
A specification of machine type, boot disk (or container
image), zone, labels and other instance properties that can
be used to instantiate either individual VM instances or a
Managed Instance Group
Features of MIGs
• Autoscaling policies
• Load balancing
• Identification and recreation of unhealthy instances
• Rolling updates
Unmanaged Instance Group
Dissimilar VM instances that are arbitrarily grouped together after-
the-fact, usually for load balancing
Unmanaged Instance Groups
• Do not support
• Autoscaling
• Rolling updates
• Do support
• Load balancing (primary use case)
Health Checks
Health Check
Managed Instance
Instance Template
Group
Health Checks
• If instances unhealthy, do not respond within time period
• Replace instance with new one
Autoscaling Policies
CPU Requests/
Utilization Second
Managed Instance
Instance Template
Group
Autoscaling Policies
• Check whether policy is being satisfied
• If more instances needed, add instances
• If fewer instances needed, remove instances
Session 8b: StackDriver,
Deployment Manager, Apigee,
Dataproc, Pubsub
Month/Year
Google Stackdriver
Suite of ops services providing monitoring, logging, debugging,
error reporting, tracing, alerting and profiling. Integrates with
several third-party tools
Stackdriver Suite
Mobile
Partners
Web
Apigee Edge
Client Apps Backend databases
Mobile
Partners
Web
Month/Year
Anthos
A single open application platform to manage and run your
applications across on-premises and cloud environments
Anthos
Modernize applications, migrate workloads, apply policies
and security at scale with a consistent experience across
on-premises and cloud
Computing Environment
• Google Kubernetes Engine (GKE) and GKE On-Prem to
manage installations
• Common orchestration layer no matter where your clusters and
applications are located
• Manages application deployment, configuration, upgrade and
scaling
Networking Environment
• Interconnect GCP and on-premises networks
• VPN tunnels using Cloud VPN on the GCP
• Dedicated and Partner interconnects for lower latency and high
throughput
Microservices Architecture
• Monolithic applications hard to scale and not robust
• Microservices architecture involve many services
communicating over the network
• Uses the service mesh model using the open-source
implementation Istio
• Manages network inconsistencies by abstracting
communication into a separate container in the same pod as
the application
Other Components
• Anthos Server Mesh to manage Istio + additional features
• Communication between services