Review Compute Engine disk encryption key management

Distinguish default storage encryption from customer key control and apply the required key policy.

Description

Compute Engine encrypts disks with Google-managed keys when diskEncryptionKey is omitted. Choose your own key if you need to control its administration or audit its use.

Potential impact

Losing a key or withdrawing access to it can interrupt disk access and recovery.

Remediation

For Cloud KMS, set kmsKeyName, check location compatibility and grant the Compute Engine service agent permission to use the key. If supplying a CSEK directly, pass rawKey securely and keep it out of stored templates and logs.

Examples

These legacy Deployment Manager excerpts show a boot disk. In a supported tool, supply the omitted VM settings, including the image and zone, and replace the example key name with your actual key.

Before

yaml
resources:
  - name: vm-template
    type: compute.v1.instance
    properties:
      disks:
        - boot: true
          autoDelete: true

After

yaml
resources:
  - name: vm-template
    type: compute.v1.instance
    properties:
      disks:
        - boot: true
          autoDelete: true
          diskEncryptionKey:
            kmsKeyName: projects/sample/locations/global/keyRings/ring/cryptoKeys/key

Verify the key associated with the disk and test recovery. For an existing disk, use a transition procedure supported for the current and intended key types.

References