Amazon web services AWS云形成在创建之前删除资源

Amazon web services AWS云形成在创建之前删除资源,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我试图为创建dynamodb编写云形成脚本。执行脚本时,堆栈中已存在获取错误 这是我的模板 AWSTemplateFormatVersion: "2010-09-09" Resources: terminationLettersDynamodb: Type: 'AWS::DynamoDB::Table' DeletionPolicy: Delete Properties: AttributeDefinitions: -

我试图为创建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"

是否有任何方法可以在创建之前删除资源。

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


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

该错误表示您有一个或多个具有相同名称的自定义命名资源。例如:您有两个同名的DynamoDB表:terminationLetters。检查您的资源名称。AWS的一篇文章解释了这个错误:。我需要删除现有表并重新创建。