使用 CloudFormation 升級 RDS 叢集的引擎版本時,系統顯示「指定群組未定義以下參數:xxx、xxx」(The following parameters are not defined for the specified group: xxx, xxx),我該如何解決這項錯誤?

1 分的閱讀內容
0

使用 AWS CloudFormation 嘗試將 Amazon Relational Database Service (Amazon RDS) 叢集的引擎版本升級時,系統顯示以下錯誤訊息:「指定群組未定義以下參數:xxx、xxx」

簡短描述

只要將採用自訂參數群組的 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'

**注意:**還有其他情況可能會導致系統顯示這個錯誤訊息。以下「解決方案」區段所提供的步驟僅適用於上述情況。

解決方案

以下步驟提供兩種解決**「指定群組未定義以下參數:xxx、xxx」**錯誤的方法

**注意:**將參數群組套用至資料庫執行個體可能會使執行個體重新啟動。重新啟動期間,資料庫服務會暫時中斷。

  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 年前