This document describes how to use predefined organization policy constraints for Memorystore for Valkey. These constraints let you put restrictions on Memorystore for Valkey at the project, folder, or organization level.
You can use organization policy constraints to help ensure customer-managed encryption key (CMEK) protection for your Memorystore for Valkey instances by controlling the CMEK settings of the instances. As a result, you not only can enforce CMEK protection for your instances, but you also can control which Cloud Key Management Service (KMS) keys you can use to help protect your data.
Organization policy constraints are enforced only on newly created Memorystore for Valkey instances. For more information, see CMEK organization policies and Organization policy constraints.
Before you begin
Before you begin to use predefined organization policy constraints, complete the prerequisites in this section.
Use the Google Cloud console, Google Cloud CLI, and APIs
To use the Google Cloud console, gcloud CLI, and APIs, do the following:
- 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 project. Learn how to check if billing is enabled on a project.
Install and initialize the Google Cloud CLI (gcloud CLI).
If you installed the gcloud CLI, then make sure you have the latest version by running
gcloud components update. To access the Memorystore for Valkey gcloud CLI commands, you need at least gcloud CLI version489.0.0.-
Enable the Memorystore for Valkey API.
Memorystore for Valkey API - If you're using an external identity provider (IdP), then you must first sign in to the gcloud CLI with your federated identity.
- Make sure that you know your organization's ID.
Assign roles
To use predefined organization policy constraints for your instances, you must have one of these IAM roles in your Google Cloud project:
roles/memorystore.admin(the Memorystore Admin role)roles/owner(the Owner role)roles/editor(the Editor role)
In addition, you must grant the roles/orgpolicy.policyAdmin (Organization Policy Administrator) role to
your user or service account. For more information about granting roles, see
Manage access to projects, folders, and organizations.
You might also get the required permissions through custom roles or other predefined roles.
Add predefined CMEK constraints to an organization policy
In this section, you add the following predefined CMEK constraints to an organization policy:
constraints/gcp.restrictNonCmekServices: enforces CMEK protection for your instances. If the Memorystore for Valkey API is in theDenypolicy list of services for this constraint, then you can't create non-CMEK-protected instances.constraints/gcp.restrictCmekCryptoKeyProjects: limit which Cloud KMS keys you can use for CMEK protection. If you configure this constraint, then the instances that use CMEK encryption must use a key from an allowed project, folder, or organization.
To add these CMEK constraints to an organization policy, do the following:
Go to the Organization policies page.
Click the menu in the Google Cloud console menu bar, and then select the project, folder, or organization that requires the organization policy.
On the Organization policies page, a list of available organization policy constraints is displayed.
To set the
constraints/gcp.restrictNonCmekServicesconstraint, follow these steps:- Filter for the constraint by using its ID:
constraints/gcp.restrictNonCmekServices. - Click the link that contains the constraint's name.
- On the Policy details page, click Manage policy.
- In the Policy source section of the Edit policy page, click the Override parent's policy option.
- In the Rules section, click the Add a rule field.
- From the Policy values menu of the New rule dialog, select Custom.
- From the Policy type menu, select Deny.
- In the Custom values field, enter
memorystore.googleapis.com. This value enforces CMEK protection when you create Memorystore for Valkey instances. - Click Set policy.
- Filter for the constraint by using its ID:
To set the
constraints/gcp.restrictCmekCryptoKeyProjectsconstraint, follow these steps:- Filter for the constraint by using its ID:
constraints/gcp.restrictCmekCryptoKeyProjects. - Click the link that contains the constraint's name.
- On the Policy details page, click Manage policy.
- In the Policy source section of the Edit policy page, click the Override parent's policy option.
- In the Rules section, click the Add a rule field.
- From the Policy values menu of the New rule dialog, select Custom.
- From the Policy type menu, select Allow.
In the Custom values field, enter the resource using the following format:
under:organizations/ORGANIZATION_ID,under:folders/FOLDER_ID, orprojects/PROJECT_ID.These values let Memorystore for Valkey instances use Cloud KMS keys only from the allowed organization, folder, or project.
Click Set policy.
- Filter for the constraint by using its ID:
What's next
- Learn more about (CMEK) for Memorystore for Valkey.
- Learn more about organization policies.
- Learn more about creating organization policies.
- View the full list of predefined organization policy constraints.