當我嘗試使用 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" 錯誤的兩種方式。
**注意:**將參數群組套用至資料庫執行個體可能會啟動執行個體重新啟動。在重新啟動期間,資料庫會中斷。
- 使用新的 Family 值,將新的 ParameterGroup 資源新增至堆疊範本,並在範本中保留舊的 ParameterGroup 資源。
- 參考 AWS::RDS::DBCluster 或 AWS::RDS::DBInstance 中新的 ParameterGroup 資源,並將 EngineVersion 屬性升級至新版本。
**注意:**如果執行的是主要版本升級,您必須將 AllowMajorVersionUpgrade 屬性設為 true。
- 使用更新的範本來更新堆疊。
- 更新堆疊之後,從堆疊範本中移除先前的 ParameterGroup 資源。
-或-
- 變更 ParameterGroup 資源的 LogicalResourceID。
- 參考 AWS::RDS::DBCluster 或 AWS::RDS::DBInstance 中的 LogicalResourceID。