amazon-web-services - 如何将AWS漂移的堆栈资源恢复到预期状态

标签 amazon-web-services aws-cloudformation

我有一个 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::*"--capability="CAPABILITY_NAMED_IAM"

我收到如下错误:

An error occurred (ValidationError) when calling the UpdateStack operation: ResourceTypes and Capabilities cannot be specified at the same time.

谁能帮我解决这个问题吗?

提前致谢。

最佳答案

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

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

关于amazon-web-services - 如何将AWS漂移的堆栈资源恢复到预期状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59730208/

相关文章:

amazon-web-services - Elasticsearch-按多个数组中数组匹配的分数排序

python - 如何使用 Python Amazon Simple Product API 获取产品价格

android - 确定 docker 中的操作系统类型

amazon-web-services - 如何使用cloudformation模板获取用户数据的输出值?

csv - AWS 数据管道 RedShift "delimiter not found"错误

amazon-web-services - S3 存储桶策略限制对单个文件夹的访问

amazon-web-services - 使用 CloudFormation 创建 SpotFleet 时出错

amazon-web-services - 使用 YAML 语法的 AWS UserData 字段中的 "!Sub |"是什么意思?

amazon-web-services - 存储桶日志记录表单 Applicationloadbalancer 的访问被拒绝 : Please check S3bucket permission

amazon-web-services - 云信息 : Autoscaling persist volume after instance stop and add tags