简体   繁体   English

为cdk生成的默认数据库设置参数组

[英]Set parameter group for the default database of cdk generated

I am making RDS by cdk我正在通过 cdk 制作 RDS

with default database.使用默认数据库。

const dbCluster = new rds.DatabaseCluster(this, 'Database', {
  engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
  credentials: rdsCredentials,
  removalPolicy: cdk.RemovalPolicy.DESTROY,
  clusterIdentifier: dbInfos['cluster'], //clusterIdentifier,
  defaultDatabaseName :dbInfos['database'], //defaultDatabaseName,
  instanceProps: {
    instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE2, ec2.InstanceSize.SMALL),
    vpcSubnets: {
      subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
    },
    vpc,
    securityGroups:[mySecurityGroup],
  },
});

I want to set the character code(utf8mb4) for this default database.我想为此默认数据库设置字符代码 (utf8mb4)。

I think I should use the parameter group for this though,,,我想我应该为此使用参数组,,,

where can I set the parameter group?我在哪里可以设置参数组?


I make the parameterGroup like this.我像这样制作参数组。

const parameterGroup = new rds.ParameterGroup(this, 'RdsParameterGroup', {
  engine: rds.DatabaseClusterEngine.auroraMysql({ version: rds.AuroraMysqlEngineVersion.VER_2_08_1 }),
  parameters: {
    time_zone: 'Asia/Tokyo',
    character_set_client: 'utf8mb4',
    character_set_connection: 'utf8mb4',
    character_set_database: 'utf8mb4',
    character_set_results: 'utf8mb4',
    character_set_server: 'utf8mb4',
    collation_connection: 'utf8mb4_bin',
    slow_query_log: '1',
    long_query_time: '1',
    log_output: 'FILE',
  },
})

and adding并添加

const dbCluster = new rds.DatabaseCluster(this, 'Database', {
  parameterGroup,
.
.
.

DatabaseCluster has a parameterGroup argument. DatabaseCluster 有一个 parameterGroup 参数。 Have you looked at it?你看过了吗? The same can be updated using the ParameterGroup or the L1 version of it with "CfnDBParameterGroup"同样可以使用 ParameterGroup 或它的 L1 版本与“CfnDBParameterGroup”进行更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CDK 部署无法识别我的引导程序和 SSM 参数 - CDK deploy not recognizing my bootstrap and SSM parameter 如果设置了条件值,则 Firebase 参数将变为默认值 - Firebase parameter going to default value if conditional value set cdk deploy 删除bootstrap版本ssm参数 - cdk deploy deletes the bootstrap version ssm parameter cdk diff 注释实际上是否从 AWS 读取以与 cdk.out 中生成的文件进行比较? - Does cdk diff comment actually read from AWS to compare with file generated in cdk.out? 如何使用 cdk 升级 eks 默认节点组版本? - how do i upgrade eks default nodegroup version using cdk? AWS CDK 说“this”类型的参数不可分配给“Construct”类型的参数 - AWS CDK says Argument of type 'this' is not assignable to parameter of type 'Construct' AWS CDK Typescript 模板中未生成导入 DynamoDB 表 - AWS CDK Typescript Import DynamoDB table not generated in template 如何使用 AWS CDK 为带有别名的 Lambda 设置 EventBridge 规则目标 - How to use AWS CDK to set EventBridge Rule Target for Lambda with Alias AWS CDK Python 使用默认操作创建 App Load Balancer Listner - AWS CDK Python Create App Load Balancer Listner with default action 使用 CDK 是否可以在创建默认 su.net 后对其进行修改? - With CDK is it possible to modify the default subnets after they have been created?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM