从DynamoDB表生成云形成模板 [英] Generate cloud formation template from DynamoDB table

查看:103
本文介绍了从DynamoDB表生成云形成模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个DynamoDB表,该表需要复制到不同的环境.管理表的最佳方法是拥有一个CloudFormation模板,以便脚本可以基于该模板创建表.鉴于表已经存在,我想知道是否有可能为现有表生成e模板,有什么想法吗?在Google中找不到很多...

I have a DynamoDB table which needs to be replicated to different environments. The best way to manage the table is by having a CloudFormation template so a script could create the table based on the template. 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...

模板看起来像这样:

"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将生成一个模板,该模板是您现有资源的副本.使用生成的模板将使用新资源创建一个新的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. Using the template that gets generated will create a new CloudFormation stack with new resources.

无法获取现有资源并将其包含在CloudFormation堆栈中.如果您希望由CloudFormation管理资源,则首先需要由CloudFormation创建资源.

There is no way to take existing resources and get them included in a CloudFormation stack. If you want your resources to be managed by CloudFormation, then they need to be created by CloudFormation in the first place.

这篇关于从DynamoDB表生成云形成模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆