简体   繁体   English

从DynamoDB表生成云形成模板

[英]Generate cloud formation template from DynamoDB table

I have a DynamoDB table which needs to be replicated to different environments. 我有一个DynamoDB表,该表需要复制到不同的环境。 The best way to manage the table is by having a CloudFormation template so a script could create the table based on the template. 管理表的最佳方法是拥有一个CloudFormation模板,以便脚本可以基于该模板创建表。 Given the table exists already I was wondering if it's possible to generate e template for the existing table, any thoughts? 鉴于表已经存在,我想知道是否有可能为现有表生成模板,有什么想法吗? Couldn't find much in google... 在Google中找不到很多...

The template would look something like this: 模板如下所示:

"Resources": {
    "CustomerTable": {
      "Type" : "AWS::DynamoDB::Table",
      "Properties" : {
        "KeySchema": [
          {
            "AttributeName": "customerId",
            "KeyType": "HASH"
          }
        ],
        "AttributeDefinitions": [
          {
            "AttributeName": "customerId",
            "AttributeType": "N"
          }
        ],
        "ProvisionedThroughput" : {
          "ReadCapacityUnits" : { "Ref": "CustomerReadCapacity" },
          "WriteCapacityUnits" : { "Ref": "CustomerWriteCapacity" }
        },
        "TableName" : "customer"
      }
    }
}

You can use CloudFormer to generate a CloudFormation template from existing resources in an AWS account. 您可以使用CloudFormer从AWS账户中的现有资源生成CloudFormation模板。

However, the template that is generated will not be linked in any way to your existing resources. 但是,生成的模板将不会以任何方式链接到您的现有资源。 CloudFormer will generate a template that is a copy of your existing resources. CloudFormer将生成一个模板,该模板是您现有资源的副本 Using the template that gets generated will create a new CloudFormation stack with new resources. 使用生成的模板将使用新资源创建一个新的CloudFormation堆栈。

There is no way to take existing resources and get them included in a CloudFormation stack. 无法获取现有资源并将其包含在CloudFormation堆栈中。 If you want your resources to be managed by CloudFormation, then they need to be created by CloudFormation in the first place. 如果要由CloudFormation管理资源,则首先需要由CloudFormation创建资源。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM