Compute Engine Flashcards
What is Compute Engine?
IaaS which allows users to create VMs, attach to persistent storage and make use of ther GCP services
What is Compute Engine made of?
Scalable, high performance virtual machines that are completely customizable.
- over 25 predefined machine types with various numbers of CPUs and memory
- customize 1-64 CPUs with up to 6.5GB RAM per CPU
What do compute engine instances run and 3 key points about those instances?
Images that contain an OS, libraries and other code.
- Google provides Linux and Windows Server images
- 3rd party vendors provide other images
- Can create custom image from boot disk or snapshot from an existing VM
Where are Compute Engines contained?
Contained in a project and run in a zone and region
- hardware costs and availability can differ between regions
What storage options are available for Compute Engine VMs?
- remote standard persistent disks
2. local solid state drives
What are some key points about Compute Engine preemptibility?
- short lived instances that can persist up to 24 hours
- low cost
- may not be available and can terminate at any time with 30 sec notice
- cannot migrate to a regular VM
- cannot be set to automatically restart
- good for apps that are fault tolerant and can withstand interruptions
What are some key points of Compute Engine?
- completely customizable
- can be made preemptible
- can create instance groups
- can set up health checks
- can attach GPU for math intensive applications
What is an instance group and what are some key points?
It lets you manage multiple VMs as a single unit.
- any gcloud command issued to the group is applied to all VMs in the group
- instance template is based of an instance and can be used to make identical instances
- all GCP load balancing requires use of an instance group
What are the two types of instance groups.
Unmanaged
- collections of instances with different configurations
- no auto-scaling
- can’t use instance templates
Managed
- collection of instances that are identical
- automatically scale and load balance
- instance that crashes can be automatically recreated
- can be set up with instance template
- zonal or regional
What is a health check?
A health check contacts the server and waits for a response. When setting up a health check, you set the frequency, how long to wait for a response and what a given number of successes or failures means in terms of health
Key points of VM billing in Compute Engine?
- billed in 1 sec increments based on machine type
- discount for sustained usage
- charged for a minimum of 1 min
- preemptible can save up to 80%
- once the instance is stopped, you are not billed
Key points of GPUs attached to a VM?
- not all zones/machine types have GPUs as an option
- can have 1, 2 or 4 GPUs attached to a machine
- cannot be attached to shared memory machines
What is a snapshot and what are some key points?
A copy of a disk that is useful for backup.
- first snapshot contains full data - subsequent ones are incremental
- if application is buffered in memory, make sure to flush it before creating snapshot
- users must have Compute Storage Admin role to work with a snapshot
What is a disk image and what are some key points?
A copy of a disk that is in a suitable format for creating a VM
- can be made from a disk, snapshot, cloud storage file or another image.
- can delete or deprecate an image
- a family is a group of related images which are usually different versions of the same underlying image
How do you create a commute engine instance via command line?
gcloud compute instances create [instance name]
Values from default project will be used if not specified
How do you view project info via command line?
gcloud compute project-info describe
How do you list the vms via command line?
gcloud compute instances list
What are some commonly used parameters when creating a VM?
- -boot-disk-size (10GB and 2TB)
- -boot-disk-type
- -labels
- -machine-type : type of machine to use, standard is n1-standard-1
- -preemptible
- -subnet [SUBNET NAME] : to create the vm in a particular VPC
How do you view available machine types for creating a VM?
gcloud compute machine-types list
VM Management: What is metadata?
Key values pairs that are stored in a metdata serer and can be queried by Compute Engine API. It’s useful if running startup or shutdown scripts and need to change behavior based on metadata values
VM Management: What options exist for availability policy?
- preemptibility
- automatic restart - auto restart if machine shut down
- on host maintenance - allows instances to be migrated to other servers during maintenance
VM Management: What security options are available?
- Shielded VM - configured to have additional security measures
- Secure Boot - only authenticated OS software can run on VM
- VTPM - Virtual Trusted Platform Module
- Integrity Monitoring - uses a known baseline of boot measurements to compare current boot measurement
- SSH keys - can block project wide SSH keys
VM Management: What disk options are available? (Not disk types)
- Specify whether boot disk is deleted when instance is deleted.
- How encryption will be managed
- Add new disk setting name, type, r/w parameters, size, encryption
VM Management: What networking options are available?
- add network tags
- add another network interface to another network
- choose a VPC and select a subnet
- specify static IP or custom ephemeral address
VM Management: What is sole tenancy?
It ensures that your VMs run on a server only with your other VMs
How do you create an instance group via command line?
gcloud compute instance-templates create [template name]
- you can specify existing VMs as a source of the instance template
- it can contain instances zonally or regionally