published on Monday, Mar 9, 2026 by Byteplus
published on Monday, Mar 9, 2026 by Byteplus
缓存数据库 Redis 版支持创建多个账号,您可以在创建账号时选择不同的角色,不同的角色支持的权限不同,帮助您实现数据库的精细化管理,提升数据安全性。
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as bytepluscc from "@byteplus/pulumi-bytepluscc";
const redisAccountDemo = new bytepluscc.redis.Account("RedisAccountDemo", {
instanceId: "redis-mlrfiqivjttxxxxx",
accountName: "ccapi_test_1",
description: "this is a test",
password: "******",
roleName: "Administrator",
});
import pulumi
import pulumi_bytepluscc as bytepluscc
redis_account_demo = bytepluscc.redis.Account("RedisAccountDemo",
instance_id="redis-mlrfiqivjttxxxxx",
account_name="ccapi_test_1",
description="this is a test",
password="******",
role_name="Administrator")
package main
import (
"github.com/byteplus-sdk/pulumi-bytepluscc/sdk/go/bytepluscc/redis"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := redis.NewAccount(ctx, "RedisAccountDemo", &redis.AccountArgs{
InstanceId: pulumi.String("redis-mlrfiqivjttxxxxx"),
AccountName: pulumi.String("ccapi_test_1"),
Description: pulumi.String("this is a test"),
Password: pulumi.String("******"),
RoleName: pulumi.String("Administrator"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Bytepluscc = Byteplus.Pulumi.Bytepluscc;
return await Deployment.RunAsync(() =>
{
var redisAccountDemo = new Bytepluscc.Redis.Account("RedisAccountDemo", new()
{
InstanceId = "redis-mlrfiqivjttxxxxx",
AccountName = "ccapi_test_1",
Description = "this is a test",
Password = "******",
RoleName = "Administrator",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.byteplus.bytepluscc.redis.Account;
import com.byteplus.bytepluscc.redis.AccountArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var redisAccountDemo = new Account("redisAccountDemo", AccountArgs.builder()
.instanceId("redis-mlrfiqivjttxxxxx")
.accountName("ccapi_test_1")
.description("this is a test")
.password("******")
.roleName("Administrator")
.build());
}
}
resources:
redisAccountDemo:
type: bytepluscc:redis:Account
name: RedisAccountDemo
properties:
instanceId: redis-mlrfiqivjttxxxxx
accountName: ccapi_test_1
description: this is a test
password: '******'
roleName: Administrator
Create Account Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Account(name: string, args: AccountArgs, opts?: CustomResourceOptions);@overload
def Account(resource_name: str,
args: AccountArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Account(resource_name: str,
opts: Optional[ResourceOptions] = None,
account_name: Optional[str] = None,
instance_id: Optional[str] = None,
password: Optional[str] = None,
role_name: Optional[str] = None,
description: Optional[str] = None)func NewAccount(ctx *Context, name string, args AccountArgs, opts ...ResourceOption) (*Account, error)public Account(string name, AccountArgs args, CustomResourceOptions? opts = null)
public Account(String name, AccountArgs args)
public Account(String name, AccountArgs args, CustomResourceOptions options)
type: bytepluscc:redis:Account
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args AccountArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args AccountArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args AccountArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args AccountArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args AccountArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var byteplusccAccountResource = new Bytepluscc.Redis.Account("byteplusccAccountResource", new()
{
AccountName = "string",
InstanceId = "string",
Password = "string",
RoleName = "string",
Description = "string",
});
example, err := redis.NewAccount(ctx, "byteplusccAccountResource", &redis.AccountArgs{
AccountName: pulumi.String("string"),
InstanceId: pulumi.String("string"),
Password: pulumi.String("string"),
RoleName: pulumi.String("string"),
Description: pulumi.String("string"),
})
var byteplusccAccountResource = new com.byteplus.bytepluscc.redis.Account("byteplusccAccountResource", com.byteplus.bytepluscc.redis.AccountArgs.builder()
.accountName("string")
.instanceId("string")
.password("string")
.roleName("string")
.description("string")
.build());
bytepluscc_account_resource = bytepluscc.redis.Account("byteplusccAccountResource",
account_name="string",
instance_id="string",
password="string",
role_name="string",
description="string")
const byteplusccAccountResource = new bytepluscc.redis.Account("byteplusccAccountResource", {
accountName: "string",
instanceId: "string",
password: "string",
roleName: "string",
description: "string",
});
type: bytepluscc:redis:Account
properties:
accountName: string
description: string
instanceId: string
password: string
roleName: string
Account Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Account resource accepts the following input properties:
- Account
Name string - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- Instance
Id string - 实例 ID。
- Password string
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- Role
Name string - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- Description string
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- Account
Name string - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- Instance
Id string - 实例 ID。
- Password string
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- Role
Name string - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- Description string
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- account
Name String - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- instance
Id String - 实例 ID。
- password String
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role
Name String - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- description String
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- account
Name string - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- instance
Id string - 实例 ID。
- password string
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role
Name string - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- description string
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- account_
name str - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- instance_
id str - 实例 ID。
- password str
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role_
name str - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- description str
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- account
Name String - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- instance
Id String - 实例 ID。
- password String
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role
Name String - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- description String
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
Outputs
All input properties are implicitly available as output properties. Additionally, the Account resource produces the following output properties:
- Account
Status string - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- Id string
- The provider-assigned unique ID for this managed resource.
- Account
Status string - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- Id string
- The provider-assigned unique ID for this managed resource.
- account
Status String - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- id String
- The provider-assigned unique ID for this managed resource.
- account
Status string - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- id string
- The provider-assigned unique ID for this managed resource.
- account_
status str - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- id str
- The provider-assigned unique ID for this managed resource.
- account
Status String - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Account Resource
Get an existing Account resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: AccountState, opts?: CustomResourceOptions): Account@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
account_name: Optional[str] = None,
account_status: Optional[str] = None,
description: Optional[str] = None,
instance_id: Optional[str] = None,
password: Optional[str] = None,
role_name: Optional[str] = None) -> Accountfunc GetAccount(ctx *Context, name string, id IDInput, state *AccountState, opts ...ResourceOption) (*Account, error)public static Account Get(string name, Input<string> id, AccountState? state, CustomResourceOptions? opts = null)public static Account get(String name, Output<String> id, AccountState state, CustomResourceOptions options)resources: _: type: bytepluscc:redis:Account get: id: ${id}- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Account
Name string - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- Account
Status string - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- Description string
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- Instance
Id string - 实例 ID。
- Password string
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- Role
Name string - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- Account
Name string - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- Account
Status string - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- Description string
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- Instance
Id string - 实例 ID。
- Password string
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- Role
Name string - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- account
Name String - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- account
Status String - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- description String
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- instance
Id String - 实例 ID。
- password String
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role
Name String - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- account
Name string - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- account
Status string - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- description string
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- instance
Id string - 实例 ID。
- password string
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role
Name string - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- account_
name str - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- account_
status str - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- description str
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- instance_
id str - 实例 ID。
- password str
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role_
name str - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
- account
Name String - 账号名称。名称需同时满足如下要求:以小写字母开头,由小写字母或者数字结尾。长度为 2~16 个字符。由小写字母、数字、下划线(_)组成。
- account
Status String - 账号状态。取值范围如下:Available:可用。Unavailable:不可用。
- description String
- 账号描述,长度不超过 256 个字符。说明若该参数为空,表示不设置账号描述。
- instance
Id String - 实例 ID。
- password String
- 账号密码。密码需同时满足如下要求:长度为 8~32 个字符。至少包含大写字母、小写字母、数字或特殊字符中的任意 2 种。支持如下特殊字符:()`~!@#$%^&*-+=_|{}[];<>,.?
- role
Name String - 账号所属角色。支持如下默认角色:Administrator:允许对所有 Key 使用所有 Redis 实例已支持的命令。ReadWrite:允许对所有 Key 使用除 admin 类之外的所有命令。ReadOnly:允许对所有 Key 使用 read 类中的所有命令。NotDangerous:允许对所有 Key 使用除 dangerous 类之外的所有命令。说明关于各角色对应 ACL 规则支持的具体命令详情,请参见 ACL 语法。
Import
$ pulumi import bytepluscc:redis/account:Account example "instance_id|account_name"
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- bytepluscc byteplus-sdk/pulumi-bytepluscc
- License
- MPL-2.0
- Notes
- This Pulumi package is based on the
byteplusccTerraform Provider.
published on Monday, Mar 9, 2026 by Byteplus
