Cloud KMS Autokey simplifies creating and using [customer-managed encryption
keys (CMEKs)](https://docs.cloud.google.com/kms/docs/cmek) by automating provisioning and assignment. With
Autokey, key rings and keys are generated on-demand. Service accounts
that use the keys to encrypt and decrypt resources are created and granted
Identity and Access Management (IAM) roles when needed. Cloud KMS administrators
retain full control and visibility of keys created by Autokey, without
needing to pre-plan and create each resource. Using Autokey is simpler
than provisioning keys yourself, and is the recommended choice if the keys
created by Autokey meet all of your requirements.

Using keys generated by Autokey can help you consistently align with
industry standards and recommended practices for data security, including the
Multi-tenant Cloud HSM protection level, separation of duties, key rotation,
location, and key specificity. Autokey creates keys that follow both
general guidelines and guidelines specific to the resource type for
Google Cloud services that integrate with Cloud KMS Autokey. After
they are created, keys requested using Autokey function identically to
other Cloud HSM keys with the same settings.

When you use Autokey, the permissions needed to request a new key are
minimal and are included in the default roles that grant resource creation
privileges. This means that your developers and infrastructure-as-code (IaC)
pipelines don't need elevated privileges. Autokey simplifies using
Terraform for key management and supports the principle of least privilege.

You can use Autokey with dedicated-project key storage (formerly
known as *centralized key management* ) or with same-project key storage
(formerly known as *delegated key management*). To use
Autokey with dedicated-project key storage, you must have an organization resource that
contains a folder resource. When you use dedicated-project key storage, you
enable Autokey for projects within a folder, and keys created by
Autokey are created in the designated key project for that folder. When
you use same-project key storage, you enable Autokey on a folder
or project to let Autokey create keys in the same project as the
resources that they protect.

For more information about organization and folder resources,
see [Resource hierarchy](https://docs.cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy.md.txt).

Cloud KMS Autokey is available in all Google Cloud locations where
Cloud HSM is available. For more information about Cloud KMS
locations, see [Cloud KMS locations](https://docs.cloud.google.com/kms/docs/locations.md.txt). There is no
additional cost to use Cloud KMS Autokey. Keys created using
Autokey are priced the same as any other Cloud HSM keys. For
more information about pricing, see [Cloud Key Management Service pricing](https://docs.cloud.google.com/kms/pricing).

For more information about Autokey, see
[Autokey overview](https://docs.cloud.google.com/kms/docs/autokey-overview.md.txt).

## Choose between Autokey and other encryption options

Cloud KMS with Autokey is like an autopilot for
customer-managed encryption keys: it does the work on your behalf, on demand.
You don't need to plan keys ahead of time or create keys that might never be
needed. Keys and key usage are consistent. You can define where you
want Autokey to be used and control who can use it. You retain full
control of the keys created by Autokey. You can use manually-created
Cloud KMS keys alongside keys created using Autokey. You can
disable Autokey and continue to use the keys it created the same way
you'd use any other Cloud KMS key.

Cloud KMS Autokey is a good choice if you want consistent key usage across
projects, with a low operational overhead, and want to follow Google's
recommendations for keys.

| Feature or capability | Google default encryption | Cloud KMS | Cloud KMS Autokey |
|---|---|---|---|
| Cryptographic isolation: keys are exclusive to one customer's account | No | Yes | Yes |
| Customer owns and controls keys | No | Yes | Yes |
| Developer triggers key provisioning and assignment | Yes | No | Yes |
| Specificity: keys are automatically created at the recommended key granularity | No | No | Yes |
| Lets you crypto-shred your data | No | Yes | Yes |
| Automatically aligns with recommended key management practices | No | No | Yes |
| Uses HSM-backed keys that are FIPS 140-2 Level 3 compliant | No | Optional | Yes |

If you need to use a protection level other than `HSM` or a custom rotation
period, you can use [CMEK](https://docs.cloud.google.com/kms/docs/cmek.md.txt) without Autokey.

## Compatible services

The following table lists services that are compatible with
Cloud KMS Autokey:

| Service | Protected resources | Key granularity |
|---|---|---|
| AlloyDB for PostgreSQL | - `alloydb.googleapis.com/Cluster` - `alloydb.googleapis.com/Backup` Integration between AlloyDB for PostgreSQL and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Apigee | - `apigee.googleapis.com/Organization` - `apigee.googleapis.com/Instance` Integration between Apigee and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Apigee API hub | - `apihub.googleapis.com/ApiHubInstance` Integration between Apigee API hub and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Artifact Registry | - `artifactregistry.googleapis.com/Repository` Autokey creates keys during Repository creation, used for all stored artifacts. | One key per resource |
| Backup and DR Service | - `backupdr.googleapis.com/BackupVault` | One key per resource |
| Backup for GKE | - `gkebackup.googleapis.com/BackupPlan` Integration between Backup for GKE and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| BigQuery | - `bigquery.googleapis.com/Dataset` Autokey creates default keys for datasets. Tables, models, queries, and temporary tables within a dataset use the dataset default key. Autokey doesn't create keys for BigQuery resources other than datasets. To protect resources that are not part of a dataset, you must create your own default keys at the project or organization level. | One key per resource |
| Bigtable | - `bigtableadmin.googleapis.com/Cluster` Autokey creates keys for clusters. Autokey doesn't create keys for Bigtable resources other than clusters. Integration between Bigtable and Cloud KMS Autokey is available only for resources that are created by using Terraform or the Google Cloud SDK. | One key per cluster |
| Cloud Run | - `run.googleapis.com/Service` - `run.googleapis.com/Job` | One key per location within a project |
| Cloud SQL | - `sqladmin.googleapis.com/Instance` Autokey doesn't create keys for Cloud SQL `BackupRun` resources. When you create a backup of a Cloud SQL instance, the backup is encrypted with the primary instance's customer-managed key. Integration between Cloud SQL and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Cloud Storage | - `storage.googleapis.com/Bucket` Objects within a storage bucket use the bucket default key. Autokey doesn't create keys for `storage.object` resources. | One key per bucket |
| Compute Engine | - `compute.googleapis.com/Disk` - `compute.googleapis.com/Image` - `compute.googleapis.com/Instance` - `compute.googleapis.com/MachineImage` Snapshots use the key for the disk that you are creating a snapshot of. Autokey doesn't create keys for `compute.snapshot` resources. | One key per resource |
| Google Kubernetes Engine | - `container.googleapis.com/Cluster` Integration between Google Kubernetes Engine and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per cluster |
| Dataflow | - `dataflow.googleapis.com/Job` | One key per resource |
| Datastream | - `datastream.googleapis.com/Stream` Integration between Datastream and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Document AI | - `documentai.googleapis.com/Processor` The key that protects a processor must be in the same location as the processor, except for multi-regions: `us-central1` for the `us` multi-region, and `europe-west4` for the `eu` multi-region. For a multi-region processor, create the key handle in the corresponding region. | One key per resource |
| Managed Service for Apache Airflow | - `composer.googleapis.com/Environment` | One key per resource |
| Managed Service for Apache Spark | - `dataproc.googleapis.com/Cluster` - `dataproc.googleapis.com/SessionTemplate` - `dataproc.googleapis.com/WorkflowTemplate` - `dataproc.googleapis.com/Batch` - `dataproc.googleapis.com/Session` | **For Cluster, SessionTemplate, and WorkflowTemplate resources:** One key per resource **For Batch and Session resources:** One key per location within a project |
| Memorystore for Redis | - `redis.googleapis.com/Instance` - `redis.googleapis.com/Cluster` Integration between Memorystore for Redis and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Memorystore for Valkey | - `memorystore.googleapis.com/Instance` Integration between Memorystore for Valkey and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Migrate to Virtual Machines | - `vmmigration.googleapis.com/MigratingVm` - `vmmigration.googleapis.com/Source` Integration between Migrate to Virtual Machines and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Pub/Sub | - `pubsub.googleapis.com/Topic` | One key per resource |
| Secret Manager | - `secretmanager.googleapis.com/Secret` Integration between Secret Manager and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per location within a project |
| Secure Source Manager | - `securesourcemanager.googleapis.com/Instance` | One key per resource |
| Spanner | - `spanner.googleapis.com/Database` Integration between Spanner and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |
| Filestore | - `file.googleapis.com/Instance` - `file.googleapis.com/Backup` | One key per resource |
| Workflows | - `workflows.googleapis.com/Workflow` Integration between Workflows and Cloud KMS Autokey is available only for resources that are created by using Terraform or the REST API. | One key per resource |

## What's next

- To learn more about how Cloud KMS Autokey works, see [Autokey
  overview](https://docs.cloud.google.com/kms/docs/autokey-overview).