gpt4 book ai didi

amazon-web-services - AWS Cloudformation 在创建之前删除资源

转载 作者:行者123 更新时间:2023-12-03 07:31:57 27 4
gpt4 key购买 nike

我尝试编写云形成脚本来创建dynamodb。当我执行脚本时,它出现错误堆栈中已存在

这是我的模板。

AWSTemplateFormatVersion: "2010-09-09"
Resources:
terminationLettersDynamodb:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Delete
Properties:
AttributeDefinitions:
- AttributeName: schemeId
AttributeType: S

KeySchema:
- AttributeName: schemeId
KeyType: HASH

ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "terminationLetters"

有没有办法在创建资源之前删除资源?

最佳答案

您应该避免使用硬编码的表名称。如果指定名称,则无法执行需要替换此资源的更新。

当省略 TableName 时,您可以使用 Ref 内部函数在堆栈中的其他位置引用动态创建的表名称,例如:Ref "terminationLettersDynamodb"

关于amazon-web-services - AWS Cloudformation 在创建之前删除资源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58234913/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com