This page describes how to add predefined organization policies on AlloyDB for PostgreSQL clusters and backups, which lets you put restrictions on AlloyDB at the project, folder, or organization level.
Customer-managed encryption keys (CMEK) organization policy
You can use the CMEK organization policy to control the CMEK settings of your AlloyDB clusters and backups. This policy lets you control the Cloud KMS keys that you use to protect your data.
AlloyDB supports two organization policy constraints that help ensure CMEK protection across an organization:
constraints/gcp.restrictNonCmekServices
: Requires CMEK protection for thealloydb.googleapis.com
. When you add this constraint and add thealloydb.googleapis.com
to theDeny
policy list of services, AlloyDB refuses to create a new cluster or a backup unless they are enabled with CMEK.constraints/gcp.restrictCmekCryptoKeyProjects
: Limits which Cloud KMS CryptoKeys you can use for CMEK protection in AlloyDB clusters and backups. With this constraint, when AlloyDB creates a new cluster or a backup with CMEK, the CryptoKey must come from an allowed project, folder, or organization.
These constraints are only enforced on newly created AlloyDB clusters and backups.
For more overview information, see CMEK organization policies. For information about CMEK organization policy constraints, see Organization policy constraints.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
- Install the Google Cloud CLI.
-
To initialize the gcloud CLI, run the following command:
gcloud init
- Add the Organization Policy Administrator role
(
roles/orgpolicy.policyAdmin
) to your user or service account from the IAM & Admin page.
Add the CMEK organization policy
To add a CMEK organization policy, follow these steps:
Go to the Organization policies page.
Click the drop-down in the Google Cloud console menu bar, and then select the project, folder, or organization that requires the organization policy. The Organization policies page displays a list of available organization policy constraints.
To set
constraints/gcp.restrictNonCmekServices
, follow these steps:- Filter for the constraint using the
ID
:constraints/gcp.restrictNonCmekServices
or theName
:Restrict which services may create resources without CMEK
. - Click the constraint Name.
- Click Edit.
- Click Customize.
- Click Add rule.
- Under Policy values, click Custom.
- Under Policy types, select Deny.
- Under Custom values, enter
alloydb.googleapis.com
. This ensures that CMEK is enforced while creating AlloyDB clusters and backups.
- Filter for the constraint using the
To set
constraints/gcp.restrictCmekCryptoKeyProjects
, follow these steps:- Filter for the constraint
ID
:constraints/gcp.restrictCmekCryptoKeyProjects
orName
:Restrict which projects may supply KMS CryptoKeys for CMEK
. - Click the constraint Name.
- Click Edit.
- Click Customize.
- Click Add rule.
- Under Policy values, click Custom.
- Under Policy types, select Allow.
Under Custom values, enter the resource using the following format:
under:organizations/ORGANIZATION_ID
,under:folders/FOLDER_ID
, orprojects/PROJECT_ID
.This ensures that your AlloyDB clusters and backups use the Cloud KMS keys only from the allowed project, folder, or organization.
- Filter for the constraint
Click Done and then click Save.
What's next
- Learn more about customer-managed encryption keys (CMEK) for AlloyDB for PostgreSQL.
- See Introduction to the Organization Policy Service to learn more about organization policies.
- Learn more about how to create and manage organization policies.
- See the full list of predefined Organization policy constraints.
- Connect using a public IP.
- Create a primary instance.