【问题标题】:How to restore the AWS drifted stack resources to the expected state如何将 AWS 漂移堆栈资源恢复到预期状态
【发布时间】:2020-04-30 23:14:29
【问题描述】:

我有一个 cloudformation 堆栈并编辑了资源属性,现在堆栈显示为漂移状态。我已经运行了 cli 命令来查找漂移的资源并得到了结果。现在我需要使用资源属性的预期值更新堆栈。但在我的 cloudformation 堆栈中,我只指定了资源参数。谁能告诉我如何使用资源及其属性更新堆栈。 我运行的命令

aws cloudformation describe-stack-resource-drifts --stack-name stack-test --query 'StackResourceDrifts[*].{LogicalResourceId: LogicalResourceId, PropertyDifferences: PropertyDifferences}

我得到如下输出:

 [
     
      {
          "LogicalResourceId": "tsets3",
          "PropertyDifferences": [
                           
              {
                  "PropertyPath": "/PublicAccessBlockConfiguration/RestrictPublicBuckets",
                  "ExpectedValue": "true",
                  "ActualValue": "false",
                  "DifferenceType": "NOT_EQUAL"
              }
          ]
      }
  ]

当我尝试使用命令时

aws cloudformation update-stack --stack-name stack-test --use-previous-template --resource-types="AWS::S3::*" --capabilities="CAPABILITY_NAMED_IAM"

我收到如下错误:

调用UpdateStack操作时出错(ValidationError):不能同时指定ResourceTypes和Capabilities。

谁能帮我解决这个问题?

提前致谢。

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation


    【解决方案1】:

    您必须使用控制台、CLI 或 SDK 修复 CloudFormation 之外的漂移

    这篇文章应该有助于纠正该特定属性的漂移: https://aws.amazon.com/blogs/aws/amazon-s3-block-public-access-another-layer-of-protection-for-your-accounts-and-buckets/

    【讨论】:

      猜你喜欢
      • 2019-06-20
      • 1970-01-01
      • 2021-05-24
      • 2018-08-06
      • 2019-06-22
      • 2018-06-21
      • 1970-01-01
      • 2018-08-01
      • 1970-01-01
      相关资源
      最近更新 更多