Amazon DynamoDB 使用无服务器修改结构 [英] Amazon DynamoDB modify structure using serverless

查看:18
本文介绍了Amazon DynamoDB 使用无服务器修改结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

修改 DynamoDB 表结构的最佳方法是什么(由于备份而擦除它没有问题)?我有一张只有 HASH KEY 的表.我必须为表添加一个 SORT KEY.

What is the best way to modify a DynamoDB table structure (no problems on erasing it because of backup)? I have a table with only HASH KEY. I have to add a SORT KEY for the table.

当我部署堆栈时收到此错误

When I deploy the stack I receive this error

错误:CloudFormation 模板无效:模板格式错误:模板的 Resources 块中未解决的资源依赖项 [DynamoDBTransactionsFinished]

有办法解决吗?

推荐答案

这就是我的工作.如果您只是从模板中删除 DynamoDB 表资源,您的模板中有对 DynamoDB 表的引用将会失败,所以我会:

Here is what I what do. You have references in your template to the DynamoDB table that will fail if you simply delete the DynamoDB table resource from your template, so I would:

  1. 添加一个与第一个表匹配的辅助表,将第一个表中的所有引用重新指向第二个表
  2. 删除第一个表
  3. 重新部署您的堆栈
  4. 再次修改模板以重新添加第一个表,但这次使用额外的排序键
  5. 将引用重新指向新的第一个表
  6. 删除第二张表
  7. 重新部署堆栈

这篇关于Amazon DynamoDB 使用无服务器修改结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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