-
Images
-
Overview
- Public and custom images
- Images are not limited to zone
- Accessible from all projects
- Customized boot disks can be created by users
- Only available within a customer's project
- Public images are provided and maintained by Google/community/vendors
-
Sharing
- Requires Compute Engine Image User role to host project
- For managed instance groups a service account must be granted role to host project with image
- Export to Cloud Storage to share images without the need for host project access
- Export image as tar.gz to Cloud Storage
- Sharing with Image User Role is preferable
-
Managing
-
Source
- Create from persistent disk
- Another image in same project
- Image shared from another project
- Compressed image from Cloud Storage
-
Family
- Image families simplify image versioning
- Groups related images together
- Useful for instance templates and scripts
- Roll forward and back between image versions
- Family always points to newest non-deprecated version
-
Deprecating
- As custom images are updated, older versions have to be retired
- Users need to be transitioned from older versions to newer ones in a manageable way
-
States
- Deprecated: Works but gives warnings
- Obsolete: New users cannot use it
- Deleted: All users cannot use it
- Active: Marks deprecated image as active again
-
Snapshots
-
Overview
- Snapshots are instance/disk backups
- Can be created while instance is running
- Can create instance copies in new zones
- Can create snapshot of boot disks or attached disks
-
Operation
- Incremental backup
- First snapshot creates a full disk copy
- Subsequently snapshots capture difference since last snapshot
- Snapshot restore combines previous snapshots to create entire disk
-
Best Practice
- Pause application/processes that write data
- Flush disk buffers
- If possible, unmount disk completely
- Take only one snapshot at a time per disk
- Schedule during off-peak hours
- Use multiple persistent disks for large data volume
- Run fstrim before snapshot (Linux) to clean up space
-
Instance Groups
-
Overview
- Groups of instances
- Backend targets for load balancers
- Managed instance group manages similar machine types
- Unmanaged instance groups allow dissimilar machines
-
Operation
- Create instance template
- Defines group configuration
- Machne type, zone, image, script
- Reusable for multiple group configrations
- Global, not regional
- Can reference regional resources, e.g. disks
- Create managed instance group from instance templates
- Regional. Can use more than one zone in a single group
-
Healthcheck
- Autohealing for managed instance groups
- Deletes and recreates failed instances
- Probes instances at a predefined interval
- Instance group must allow healthcheck traffic
- Firewall rule must allow ingress traffic from 35.191.0.0/16, 130.211.0.0/22 (Global) and 35.191.0.0/16,209.85.152.0/22,209.85.204.0/22 (Regional)
-
Implementation
- Managed instance groups often paired with Load Balancers
- Load Balancers must be assigned to a backend
- Load Balancers contain one or more backend services
- Backends link to one instance group
- Backend service knows which backend to use - directs traffic
- Subject to firewall rules for allowed traffic
- Firewall rules apply to instances, not load balancer
- Backends must allow load balancer and healthcheck addresses