Prepare and test your skills

Prepare and test your skills

Security, Access, and Metadata Management in Compute Engine (opens in a new tab) is the set of launch settings that controls who can reach an instance, what the instance can reach, and how the instance configures itself on boot. Security settings are configured in the Security pane of the Create an instance page, while automation and custom data are configured in the Advanced pane. Together these settings let an instance start in a known, secure state without manual setup after boot.
Securing VM access means controlling which users can connect to a Compute Engine instance and protecting the instance from low-level attacks. VM access combines Identity and Access Management (IAM) roles and permissions with Secure Shell (SSH) keys for authentication, so only authorized users can create, manage, or log in. Data flow for access moves from the user through IAM checks to the instance, and then through SSH key authentication to the guest operating system.
The Security pane provides three peer protections that work at different layers:
Assigning Service Accounts to Instances means attaching an identity that software on the instance uses when it calls Google Cloud services and APIs. The instance depends on the service account, so requests flow from software running on the instance to the target API using the service account credentials. Assigning the correct service account at launch enforces least privilege because the instance can only access the resources its service account is allowed to use. The service account is selected in the Security pane during instance creation.
Automating Initialization with Metadata and Startup Scripts provides stored data and automatic actions that configure a Compute Engine instance each time it boots. Custom metadata stores unique key-value information about the instance, such as environment names or configuration flags, that software on the instance can read. A startup script is automation that runs commands to install packages, write files, or enforce security settings.
A five-step flow showing custom metadata and startup script attached at creation, read during boot, then executed to configure the instance, repeating on every start and reboot.
The two options differ in what they hold and when they apply:
| Option | What it stores or does | When it applies |
|---|---|---|
| Custom metadata | Stores unique key-value information about the instance | Available to the instance during runtime |
| Startup script | Runs commands to initialize or harden the instance | Runs on every start and every reboot |
The initialization flow moves from stored configuration to execution: metadata is attached to the instance at creation, the instance reads the metadata during boot, and then the startup script executes using those values. Because this order repeats on every boot, the same security configuration is enforced even after a stop and start.
Exam tip: A startup script runs each time the instance starts or reboots, not only on the first creation.
Permissions Required for Secure Launch are the IAM permissions that allow a user to attach identity and configuration to a new instance. The base permission compute.instances.create on the project is required to create the instance, and additional permissions are required for each security-related field. The control plane checks these permissions before the instance is created, so a missing permission blocks the launch.
compute.instances.setMetadata on the project is required to set instance metadata.compute.instances.setServiceAccount on the VM is required to set the service account the VM will use.compute.instances.setTags on the VM is required to set network tags used by firewall rules.compute.instances.setLabels on the VM is required to set labels used for organization.Availability Policies and Maintenance Behavior in Compute Engine (opens in a new tab) control how a virtual machine (VM) instance handles host maintenance, unexpected stops, and capacity choices. A Compute Engine instance is either a VM instance or a bare metal instance, and the policy decisions are made at creation time alongside machine type, location, and storage. Together these settings determine whether a workload stays running, restarts by itself, or relies on other instances to keep serving traffic.
Provisioning Models for a Compute Engine instance are the capacity choices that affect cost and availability continuity. The provisioning type is configured in the Advanced pane of the Create an instance page, in the same area as metadata, reservations, and sole-tenancy. A related option is Reservations, which lets an instance consume reserved zonal resource capacity to ensure better resource availability.
The documentation lists four provisioning models for Compute Engine instances:
Choosing standard or reservation-bound supports stable, long-running needs, while choosing spot trades continuity for lower-cost capacity that can be reclaimed.
Automatic Restart and Recovery for a Compute Engine instance answers whether Compute Engine should bring the workload back after a stop, crash, or unresponsive application. Leaving a failed VM stopped helps when the team wants to investigate the root cause before restarting, while automatic recreation supports services that must return without manual steps. For groups of identical VMs, recovery is handled at the group level through managed instance groups, which can recreate and autoheal instances from a common instance template.
On-Host Maintenance and Zonal Resilience for Compute Engine instances describe how infrastructure work and zone failures affect instance availability. Google deploys Compute Engine resources in worldwide regions and zones, and a workload placed in a single zone stops serving if that zone has a failure. Protection against zonal failures requires spreading VMs across zones in a region and distributing traffic so healthy instances continue to receive requests. The minimum uptime SLO for Compute Engine is 99.5%, and the actual SLO varies depending on the regions and Network Service Tiers chosen and the deployment configuration.
Operational continuity during maintenance depends on the load-balancing and scaling topology around the instances. Traffic flows from a Cloud Load Balancing load balancer to healthy backend instances, so an unavailable instance no longer receives new requests while the remaining instances handle the load. An autoscaler adds or removes instances in a managed instance group as demand changes, which helps maintain response time when capacity is reduced for maintenance. Cloud Monitoring uptime checks send requests to websites to verify availability, and an alerting policy creates an incident if a check fails, so the team can detect when maintenance or a failure has reduced continuity.
Instance Resource and Image Configuration is the choice of machine type and boot image that defines what a Compute Engine instance can do and what it costs to run. A Compute Engine instance (opens in a new tab) is a virtual machine (VM) or bare metal server hosted on Google infrastructure, and each instance belongs to a Google Cloud project with a selected zone, machine type, and operating system. The machine type sets the number of virtual CPUs and amount of memory, while the image provides the base operating environment on the boot disk.
Machine Type Specifications define the virtual CPUs and memory for an instance and determine whether the instance is a VM or bare metal. If the machine type name ends in -metal, the instance is a bare metal instance with no hypervisor installed; otherwise the instance is a VM instance. You can choose from predefined machine types, including shared-core types such as e2-small for small workloads, or you can create a custom machine type with a specific CPU and memory combination. Selecting a larger machine type increases performance for demanding applications but also increases cost, while a smaller or shared-core type lowers cost for light workloads.
Exam tip: A machine type ending in -metal creates a bare metal instance without a hypervisor; all other machine types create a VM instance.
Boot Disk Selection configures the small disk attached to every instance by default that contains the operating system used to start the instance. During creation you configure the boot disk by selecting the operating system, the OS version, the boot disk type, and the size in gigabytes. For Hyperdisk Balanced boot disks you can also set provisioned IOPS and provisioned throughput to match storage performance needs. You can add more data disks at creation time or while the instance is running, so storage can grow separately from the boot environment.
Public Versus Custom Images is the choice between a Google-supplied operating system image and a private image you create and maintain. A public image is a Google-supplied image, such as Debian, Ubuntu, and CentOS, that is updated on a regular basis. Some Linux distributions are available at no extra cost, while premium images such as Red Hat Enterprise Linux and Microsoft Windows incur additional fees for every hour the instance runs. A custom image is a private image you create from a configured disk or import from an existing system, and it is stored as a reference to an immutable disk.
A bootable image must contain a partition table and a bootable partition, and its bytes are saved as disk.raw, archived with tar, compressed with GZIP, uploaded to Cloud Storage, and then registered as an image in Compute Engine. A registered image can be used to create exact replicas of the original disk in any Google Cloud region, which makes new instances start quickly and consistently.
| Image type | Source and maintenance | Choose when |
|---|---|---|
| Public image | Supplied and updated by Google; some OS options are free and premium OS options add an hourly fee | You need a standard, maintained OS and want to customize after boot |
| Custom image | Created from your configured disk or imported by you; you control versioning and sharing between projects | You need every instance to start from the same standardized environment or to scale and recover quickly |
Custom images support standardized deployment because every instance boots from the same preconfigured operating system and application files. They also support disaster recovery and rollback because application versions can be archived as images. As an alternative, a startup script can install software each time an instance boots, but the script must be idempotent so repeated boots do not leave the instance in an inconsistent state.
compute.instances.create on the project, plus compute.instances.setMetadata, compute.instances.setServiceAccount, compute.instances.setTags, and compute.instances.setLabels for those fields.-metal creates a bare metal instance without a hypervisor, while all other machine types create virtual machine instances.Custom metadata in Compute Engine stores unique key-value information about an instance that software can read during runtime, while a startup script runs commands to install packages, write files, or enforce security settings. Metadata is attached at creation, read during boot, and then used by the startup script, which runs on every start and every reboot.
Use a public image in Compute Engine when you need a standard, maintained operating system such as Debian, Ubuntu, or CentOS and want to customize after boot, while premium options such as Red Hat Enterprise Linux and Microsoft Windows add an hourly fee. Use a custom image when you need every instance to start from the same standardized environment or to scale and recover quickly, because it creates exact replicas of a configured disk in any Google Cloud region.
Creating a Compute Engine instance requires compute.instances.create on the project, plus additional permissions for security-related fields that are checked before creation. Setting instance metadata requires compute.instances.setMetadata on the project, setting the service account requires compute.instances.setServiceAccount on the virtual machine (VM), setting network tags requires compute.instances.setTags on the virtual machine (VM), and setting labels requires compute.instances.setLabels on the virtual machine (VM).
Compute Engine lists standard, spot, flex-start in Preview, and reservation-bound provisioning models, configured in the Advanced pane with metadata, reservations, and sole-tenancy. Choosing standard or reservation-bound supports stable, long-running needs, while choosing spot trades continuity for lower-cost spare capacity that can be reclaimed.
Your company needs to deploy several Compute Engine virtual machines (VMs) for an internal web application. Each VM requires a specific operating system, pre-installed proprietary business applications, and customized security configurations.
You want to deploy these instances quickly with a consistent baseline configuration while ensuring the baseline image is private and restricted only to your Google Cloud project.
Which image deployment strategy should you recommend?
Last updated