Aws CloudFormation:无效的模板属性或属性[类型,属性]

时间:2016-07-13 20:19:06

标签: amazon-web-services amazon-cloudformation aws-rds

我正在尝试从现有快照ID创建新的Sql服务器 - RDS实例(具有更多存储空间)。下面是我的CloudFormation模板抛出错误“模板包含错误:模板属性或属性无效[类型,属性]”

"MyDB" : {
  "Type" : "AWS::RDS::DBInstance",
   "Properties" : {
      "DBName" : { "Ref" : "NSGlobal" },
      "DBSnapshotIdentifier":"rds:xxxxxxxxx-2016-07-13-17-00",
      "AllocatedStorage" : "400",
      "DBInstanceClass" : "db.m2.xlarge",
      "EngineVersion" : "11.0"
   }
}

我从AWS网站http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-database-instance.html#cfn-rds-dbinstance-masterusername复制了此模板并对其进行了定制。有什么问题?

2 个答案:

答案 0 :(得分:1)

您缺少Engine属性,请使用下面的模板。这是引擎的有效选项。

有效值:MySQL | mariadb | oracle-se1 | oracle-se | oracle-ee | sqlserver-ee | sqlserver-se | sqlserver-ex | sqlserver-web | postgres |极光

        "MyDB" : {
          "AWSTemplateFormatVersion" : "2010-09-09", 
          "Resources" : { 
          "DBInstance" : { 
          "Type": "AWS::RDS::DBInstance", 
          "Properties": { 
             "DBInstanceClass" : "db.m2.xlarge", 
             "AllocatedStorage" : "400", 
             "MasterUsername" : "myusername", 
             "MasterUserPassword" : "mypassword", 
             "DBSnapshotIdentifier":"xxxxxxxx-2016-07-13-17-00" 
         } 
      } 
    } 
}

答案 1 :(得分:1)

这有效:

{
    "AWSTemplateFormatVersion" : "2010-09-09",
    "Resources" : {
        "DBInstance" : {
            "Type": "AWS::RDS::DBInstance",
            "Properties": {
                "DBInstanceClass" : "db.m2.xlarge", 
                "AllocatedStorage" : "400", 
                "MasterUsername" : "myusername", 
                "MasterUserPassword" : "mypassword", 
                "DBSnapshotIdentifier":"xxxxxxxx-2016-07-13-17-00" 
            }
        }
    }
}

MasterUserName和MasterUserPassword不是必需的,即使没有它们,模板也会有效。

请参阅此主题以获取更多信息:Creating SQL RDS instance in CloudFormation