如何解决 使用 CloudFormation 升级 RDS 集群的引擎版本时出现的“The following parameters are not defined for the specified group”错误?

2 分钟阅读
0

当我尝试使用 AWS CloudFormation 升级 Amazon Relational Database Service(Amazon RDS)集群的引擎版本时,出现以下错误: “The following parameters are not defined for the specified group.”

简短描述

在升级使用了自定义参数组的 Amazon RDS 数据库集群或实例时,如果更新以下内容,就会收到错误:

例如,在以下模板中,将 DBInstance 资源中的 EngineVersion 属性从 5.7.37 更新到 8.0.28 会导致堆栈更新失败。将 DBParameterGroup 资源中的 Family 属性从 MySQL5.7 更新到 MySQL8.0 时,堆栈更新也会失败。

Parameters:
  DBName:
    Default: MyDatabase
    Description: The database name
    Type: String
  DBUser:
    NoEcho: 'true'
    Description: The database admin account username
    Type: String
  DBPassword:
    NoEcho: 'true'
    Description: The database admin account password
    Type: String
Resources:
  MyDB:
    Type: 'AWS::RDS::DBInstance'
    Properties:
      DBName: !Ref DBName
      AllocatedStorage: '5'
      DBInstanceClass: db.t2.small
      Engine: MySQL
      EngineVersion: 5.7.37
      MasterUsername: !Ref DBUser
      MasterUserPassword: !Ref DBPassword
      DBParameterGroupName: !Ref MyRDSParamGroup
      AllowMajorVersionUpgrade: true
  MyRDSParamGroup:
    Type: 'AWS::RDS::DBParameterGroup'
    Properties:
      Family: MySQL5.7
      Description: CloudFormation Sample Database Parameter Group
      Parameters:
        autocommit: '1'
        general_log: '1'
        old_passwords: '0'

**注意:**其他情况也可能导致此错误消息。以下解决方法中的步骤仅适用于前述场景。

解决方法

以下两种操作步骤都可以解决此错误: “The following parameters are not defined for the specified group.”

**注意:**将参数组应用于数据库实例可能会重启实例。在重新启动期间,数据库会出现中断。

  1. 使用新的 Family 值将新的 ParameterGroup 资源添加到堆栈模板中,并将旧的 ParameterGroup 资源保留在模板中。
  2. AWS::RDS::DBClusterAWS::RDS::DBInstance 中引用新的 ParameterGroup 资源,并将 EngineVersion 属性更新到新版本。
    **注意:**如果您正在进行主要版本升级,则必须将 AllowMajorVersionUpgrade 属性设置为 True
  3. 使用更新后的模板更新堆栈。
  4. 堆栈更新后,从堆栈模板中移除先前的 ParameterGroup 资源。

-或者-

  1. 更改 ParameterGroup 资源的 LogicalResourceID
  2. AWS::RDS::DBClusterAWS:: RDS::DBInstance 中引用新的 LogicalResourceID
AWS 官方
AWS 官方已更新 2 年前