删除了 Cloudformation Stack,由于资源已经存在,现在无法重新创建新的 Stack

Deleted Cloudformation Stack, now unable to recreate new ones due to resources already existing

我 运行 导致我的堆栈变得无法恢复,我别无选择,只能删除它。使用完全相同的模板,我继续创建了另一个同名的堆栈。

The following resource(s) failed to create: [AdminPanelCDNAccessIdentity, 
BackendLogGroup, BackendLoadBalancerSecurityGroup, AdminPanelCertificate, 
EnvironmentCertificate, AdminPanelBucket, BackendECSTaskRole, 
BackendECSTaskBitbucketAccess2RunTask, BackendLoadBalancerTargetGroup]. The 
following resource(s) failed to update: [FrontEndBucket].

我真的需要手动删除所有这些资源并从头开始重建它们吗?这似乎是一个糟糕的选择。

这是我的模板代码的示例片段

Resources:
FrontEndBucket:
Type: 'AWS::S3::Bucket'
Properties:
  BucketName: !If 
    - IsProduction
    - 'Fn::ImportValue': !Sub '${LandscapeStack}-DNSDomain'
    - 'Fn::Sub':
        - '${EnvironmentSubdomain}.${LandscapeDomain}'
        - LandscapeDomain:
            'Fn::ImportValue': !Sub '${LandscapeStack}-DNSDomain'
  AccessControl: Private
  Tags:
    - Key: landscape
      Value: !Ref Landscape
    - Key: environment
      Value: !Ref EnvironmentName
  WebsiteConfiguration:
    IndexDocument: index.html
Metadata:
  'AWS::CloudFormation::Designer':
    id: 53eb6c3a-767f-46fb-a719-2846f1fd6bdd
FrontEndBucketPolicy:
Type: 'AWS::S3::BucketPolicy'
Properties:
  Bucket: !Ref FrontEndBucket
  PolicyDocument:
    Statement:
      - Effect: Allow
        Action:
          - 's3:PutObject'
          - 's3:GetObject'
          - 's3:DeleteObject'
        Resource: !Sub 'arn:aws:s3:::${FrontEndBucket}/*'
        Principal:
          AWS:
            'Fn::ImportValue': !Sub '${CIResourcesStack}-BitbucketFrontEndPipelineUser'
      - Effect: Allow
        Action:
          - 's3:ListBucket'
        Resource: !Sub 'arn:aws:s3:::${FrontEndBucket}'
        Principal:
          AWS:
            'Fn::ImportValue': !Sub '${CIResourcesStack}-BitbucketFrontEndPipelineUser'
      - Effect: Allow
        Action:
          - 's3:GetObject'
        Resource: !Sub 'arn:aws:s3:::${FrontEndBucket}/*'
        Principal:
          CanonicalUser: !GetAtt FrontEndCDNAccessIdentity.S3CanonicalUserId
Metadata:
  'AWS::CloudFormation::Designer':
    id: f8d2a536-790c-4cbe-adcb-b50754c0922e

如有任何帮助,我们将不胜感激!!

您可能选择了在删除堆栈时保留所有未能删除的资源。 CloudFormation 不会将现有资源采用到堆栈中。在部署这个完全相同的堆栈之前,您需要手动删除旧堆栈创建的所有资源。或者您可以在再次部署之前更改资源的名称。