Updating user settings
After creating a Valkey™ user, you can:
Changing a user password
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change a Valkey™ user password:
-
View the description of the CLI command for updating user settings:
yc managed-redis user update --help -
Change the password by running this command:
yc managed-redis user update <username> \ --cluster-id=<cluster_ID> \ --password="<user_password>"Where:
-
--cluster-id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
--password: User password. It must be from 8 to 128 characters long.
You can get the username with the list of users in the cluster.
-
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Update the
passwordsargument in theyandex_mdb_redis_userresource description:resource "yandex_mdb_redis_user" "<local_resource_name>" { ... passwords = ["<user_password>"] ... }Where
passwordsis the user password. It must be from 8 to 128 characters long.You can specify only one password.
-
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
Timeouts
The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring it from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the timeout are aborted.
How do I change these limits?
Add the timeouts section to your cluster description, such as the following:
resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ "updateMask": "passwords", "passwords": [ "<user_password>" ] }Where:
-
updateMask: Comma-separated string of settings you want to update.Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
updateMaskparameter. -
passwords: User password. It must be from 8 to 128 characters long.You can specify only one password.
-
-
Call the User.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/users/<username>' \ --data "@body.json"You can get the cluster ID with the list of clusters in the folder.
You can get the username with the list of users in the cluster.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "user_name": "<username>", "update_mask": { "paths": [ "passwords" ] }, "passwords": [ "<user_password>" ] }Where:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
user_name: Username.You can get the username with the list of users in the cluster.
-
update_mask: List of parameters to update as an array of strings (paths[]).Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
update_maskparameter. -
passwords: Password. It must be from 8 to 128 characters long.You can specify only one password.
-
-
Call the UserService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/user_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.UserService.Update \ < body.json -
Check the server response to make sure your request was successful.
Changing a user status
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To change a Valkey™ user status:
-
View the description of the CLI command for updating user settings:
yc managed-redis user update --help -
Change the user status by running this command:
yc managed-redis user update <username> \ --cluster-id=<cluster_ID> \ <user_status>Where:
-
--cluster-id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
Specify one of these user status flags:
--disabled: User is disabled.--enabled: User is enabled.
You can get the username with the list of users in the cluster.
-
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Update the
enabledargument in theyandex_mdb_redis_userresource description:resource "yandex_mdb_redis_user" "<local_resource_name>" { ... enabled = <user_status> ... }Where
enabledis the user status. The possible values are:true: User is enabled.false: User is disabled.
-
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
Timeouts
The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring it from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the timeout are aborted.
How do I change these limits?
Add the timeouts section to your cluster description, such as the following:
resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ "updateMask": "enabled", "enabled": <user_status> }Where:
-
updateMask: Comma-separated string of settings you want to update.Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
updateMaskparameter. -
enabled: User status. The possible values are:true: User is enabled.false: User is disabled.
-
-
Call the User.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/users/<username>' \ --data "@body.json"You can get the cluster ID with the list of clusters in the folder.
You can get the username with the list of users in the cluster.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "user_name": "<username>", "update_mask": { "paths": [ "enabled" ] }, "enabled": <user_status> }Where:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
user_name: Username.You can get the username with the list of users in the cluster.
-
update_mask: List of parameters to update as an array of strings (paths[]).Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
update_maskparameter. -
enabled: User status. The possible values are:true: User is enabled.false: User is disabled.
-
-
Call the UserService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/user_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.UserService.Update \ < body.json -
Check the server response to make sure your request was successful.
Configuring data cleanup
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To configure data cleanup:
-
View the description of the CLI command for updating user settings:
yc managed-redis user update --help -
Configure data cleanup by running this command:
yc managed-redis user update <username> \ --cluster-id=<cluster_ID> \ --sanitize-payload=<data_cleanup>Where:
-
--cluster-id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
--sanitize-payload: Data cleanup. The possible values are:sanitize-payload: Data cleanup is enabled. This is the default value.skip-sanitize-payload: Data cleanup is disabled.
You can get the username with the list of users in the cluster.
-
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Update the
sanitize_payloadargument in theyandex_mdb_redis_userresource description:resource "yandex_mdb_redis_user" "<local_resource_name>" { ... sanitize_payload = "<data_cleanup>" ... }Where
--sanitize-payloadstands for data cleanup. The possible values are:sanitize-payload: Data cleanup is enabled. This is the default value.skip-sanitize-payload: Data cleanup is disabled.
-
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
Timeouts
The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring it from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the timeout are aborted.
How do I change these limits?
Add the timeouts section to your cluster description, such as the following:
resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ "updateMask": "permissions.sanitizePayload", "permissions": { "sanitizePayload": "<data_cleanup>" } }Where:
-
updateMask: Comma-separated string of settings you want to update.Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
updateMaskparameter. -
permissions.sanitizePayload: Data cleanup. The possible values are:sanitize-payload: Data cleanup is enabled. This is the default value.skip-sanitize-payload: Data cleanup is disabled.
-
-
Call the User.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/users/<username>' \ --data "@body.json"You can get the cluster ID with the list of clusters in the folder.
You can get the username with the list of users in the cluster.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "user_name": "<username>", "update_mask": { "paths": [ "permissions.sanitize_payload" ] }, "permissions": { "sanitize_payload": "<data_cleanup>" } }Where:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
user_name: Username.You can get the username with the list of users in the cluster.
-
update_mask: List of parameters to update as an array of strings (paths[]).Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
update_maskparameter. -
permissions.sanitize_payload: Data cleanup. The possible values are:sanitize-payload: Data cleanup is enabled. This is the default value.skip-sanitize-payload: Data cleanup is disabled.
-
-
Call the UserService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/user_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.UserService.Update \ < body.json -
Check the server response to make sure your request was successful.
Assigning user permissions
If you do not have the Yandex Cloud CLI installed yet, install and initialize it.
By default, the CLI uses the folder specified when creating the profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also set a different folder for any specific command using the --folder-name or --folder-id parameter.
To assign permissions to a Valkey™ user:
-
View the description of the CLI command for updating user settings:
yc managed-redis user update --help -
Run this command to assign permissions to a user:
yc managed-redis user update <username> \ --cluster-id=<cluster_ID> \ --raw="<permissions>" \ --categories="<permissions_for_command_categories>" \ --commands="<permissions_for_commands>" \ --patterns="<permissions_for_key_patterns>" \ --pub-sub-channels="<permissions_for_channels>"Where:
-
--cluster-id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
--raw: String of space-separated permissions. Also, the string must set the user status:on: User is enabled.off: User is disabled.
Example:
on ~data:* &* +@set +@hash +get +set.Note
The
--rawflag cannot be used with separate permission flags or with--disabledand--enabled. -
--categories: String of space-separated permissions for command categories. -
--commands: String of space-separated permissions for commands. -
--patterns: String of space-separated permissions for key patterns. -
--pub-sub-channels: String of space-separated permissions for Pub/Sub channels.
Note
The user cannot get permissions for administrative commands of the
+@admincategory and certain commands.For more information about access control lists, see this Valkey™ ACL guide
.You can get the username with the list of users in the cluster.
-
-
Open the current Terraform configuration file describing your infrastructure.
To learn how to create this file, see Creating a cluster.
-
Update the arguments in the
permissionssection of theyandex_mdb_redis_userresource description:resource "yandex_mdb_redis_user" "<local_resource_name>" { ... permissions = { categories = "<permissions_for_command_categories>" commands = "<permissions_for_commands>" patterns = "<permissions_for_key_patterns>" pub_sub_channels = "<permissions_for_channels>" ... } ... }Where
permissionsis the user permission settings:-
categories: String of space-separated permissions for command categories. -
commands: String of space-separated permissions for commands. -
patterns: String of space-separated permissions for key patterns. -
pub_sub_channels: String of space-separated permissions for Pub/Sub channels.
Note
The user cannot get permissions for administrative commands of the
+@admincategory and certain commands.For more information about access control lists, see this Valkey™ ACL guide
. -
-
Validate your configuration.
-
In the command line, navigate to the directory that contains the current Terraform configuration files defining the infrastructure.
-
Run this command:
terraform validateTerraform will show any errors found in your configuration files.
-
-
Confirm resource changes.
-
Run this command to view the planned changes:
terraform planIf you described the configuration correctly, the terminal will display a list of the resources to update and their parameters. This is a verification step that does not apply changes to your resources.
-
If everything looks correct, apply the changes:
-
Run this command:
terraform apply -
Confirm updating the resources.
-
Wait for the operation to complete.
-
-
Timeouts
The Terraform provider sets the following timeouts for Yandex Managed Service for Valkey™ cluster operations:
- Creating a cluster, including by restoring it from a backup: 15 minutes.
- Editing a cluster: 60 minutes.
- Deleting a cluster: 15 minutes.
Operations exceeding the timeout are aborted.
How do I change these limits?
Add the timeouts section to your cluster description, such as the following:
resource "yandex_mdb_redis_cluster_v2" "<cluster_name>" {
...
timeouts {
create = "1h30m" # 1 hour 30 minutes
update = "2h" # 2 hours
delete = "30m" # 30 minutes
}
}
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Create a file named
body.jsonand paste the following code into it:{ "updateMask": "<list_of_settings_to_update>", "permissions": { "patterns": "<permissions_for_key_patterns>", "pubSubChannels": "<permissions_for_channels>", "categories": "<permissions_for_command_categories>", "commands": "<permissions_for_commands>" } }Where:
-
updateMask: Comma-separated string of settings you want to update.Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
updateMaskparameter. -
permissions.patterns: String of space-separated permissions for key patterns. -
permissions.pubSubChannels: String of space-separated permissions for Pub/Sub channels. -
permissions.categories: String of space-separated permissions for command categories. -
permissions.commands: String of space-separated permissions for commands.
Note
The user cannot get permissions for administrative commands of the
+@admincategory and certain commands.For more information about access control lists, see this Valkey™ ACL guide
. -
-
Call the User.Update method, e.g., via the following cURL
request:curl \ --request PATCH \ --header "Authorization: Bearer $IAM_TOKEN" \ --header "Content-Type: application/json" \ --url 'https://mdb.api.cloud.yandex.net/managed-redis/v1/clusters/<cluster_ID>/users/<username>' \ --data "@body.json"You can get the cluster ID with the list of clusters in the folder.
You can get the username with the list of users in the cluster.
-
Check the server response to make sure your request was successful.
-
Get an IAM token for API authentication and place it in an environment variable:
export IAM_TOKEN="<IAM_token>" -
Clone the cloudapi
repository:cd ~/ && git clone --depth=1 https://github.com/yandex-cloud/cloudapiBelow, we assume that the repository contents reside in the
~/cloudapi/directory. -
Create a file named
body.jsonand paste the following code into it:{ "cluster_id": "<cluster_ID>", "user_name": "<username>", "update_mask": { "paths": [ <list_of_settings_to_update> ] }, "permissions": { "patterns": "<permissions_for_key_patterns>", "pub_sub_channels": "<permissions_for_channels>", "categories": "<permissions_for_command_categories>", "commands": "<permissions_for_commands>" } }Where:
-
cluster_id: Cluster ID.You can get the cluster ID with the list of clusters in the folder.
-
user_name: Username.You can get the username with the list of users in the cluster.
-
update_mask: List of parameters to update as an array of strings (paths[]).Format for listing settings
"update_mask": { "paths": [ "<setting_1>", "<setting_2>", ... "<setting_N>" ] }Warning
When you update a user, all parameters of the object you are modifying will take their defaults unless explicitly provided in the request. To avoid this, list the settings you want to change in the
update_maskparameter. -
permissions.patterns: String of space-separated permissions for key patterns. -
permissions.pub_sub_channels: String of space-separated permissions for Pub/Sub channels. -
permissions.categories: String of space-separated permissions for command categories. -
permissions.commands: String of space-separated permissions for commands.
Note
The user cannot get permissions for administrative commands of the
+@admincategory and certain commands.For more information about access control lists, see this Valkey™ ACL guide
. -
-
Call the UserService.Update method, e.g., via the following gRPCurl
request:grpcurl \ -format json \ -import-path ~/cloudapi/ \ -import-path ~/cloudapi/third_party/googleapis/ \ -proto ~/cloudapi/yandex/cloud/mdb/redis/v1/user_service.proto \ -rpc-header "Authorization: Bearer $IAM_TOKEN" \ -d @ \ mdb.api.cloud.yandex.net:443 \ yandex.cloud.mdb.redis.v1.UserService.Update \ < body.json -
Check the server response to make sure your request was successful.