【问题标题】:AWS CLI Cloudformation OperationInProgressException when calling the CreateStackInstances operation调用 CreateStackInstances 操作时出现 AWS CLI Cloudformation OperationInProgressException
【发布时间】:2019-04-22 00:25:59
【问题描述】:

我正在使用 aws cli 创建 cloudformation 堆栈集

echo "正在创建堆栈集..."

some_stackset_id=$(aws cloudformation create-stack-set \
  --stack-set-name $StacksetName \
  --template-url $TemplateURL \
  --capabilities '["CAPABILITY_NAMED_IAM"]' \
  --administration-role-arn "arn:aws:iam::000000000009:role/AWSCloudFormationStackSetAdministrationRole" \
  --execution-role-name "AWSCloudFormationStackSetExecutionRole" \
  --parameters '[
  {"ParameterKey":"env","ParameterValue":"DEV","UsePreviousValue": false, "ResolvedValue": "DEV"}

  ]' \
  | jq '.StackSetId')

echo "等待创建堆栈实例..."

aws cloudformation wait stack-create-complete \
  --region $region \
  --stack-name $some_stackset_id

echo "正在创建堆栈实例..."

some_id=$(aws cloudformation create-stack-instances \
  --stack-set-name myStackset\
  --accounts '["0000030000"]' \
  --regions '["us-east-1"]' 
  --operation-preferences='
  {
  "RegionOrder": ["us-east-1"],
  "FailureToleranceCount": 0,
  "MaxConcurrentCount": 3
}' | jq '.OperationId')

echo "完成创建堆栈实例"

当我等待堆栈集完成创建然后我可以在该堆栈集中创建堆栈实例时,cli 应该是

等到堆栈状态为 CREATE_COMPLETE。它将每 30 次投票 秒,直到达到成功状态。这将退出 120 次检查失败后返回代码 255。 https://docs.aws.amazon.com/cli/latest/reference/cloudformation/wait/stack-create-complete.html

但是,这不是我观察到的行为。一旦 cli 到达 aws cloudformation wait stack-create-complete...,它不会像根据 cli 文档那样等待 30 秒,而是继续执行下一个命令 (create-stack -instances) 失败,OperationInProgressException 知道为什么吗?

【问题讨论】:

    标签: amazon-web-services amazon-cloudformation aws-cli


    【解决方案1】:

    Cloudformation stackSet 不同于堆栈。您使用的服务员aws cloudformation wait stack-create-complete 用于堆栈,而不是堆栈集。不幸的是,此时没有用于 stackSets 的服务员,尽管使用 bash 循环创建自己的服务员并不困难。

    【讨论】:

      猜你喜欢
      • 2016-10-20
      • 2020-06-08
      • 2021-09-07
      • 1970-01-01
      • 2020-12-11
      • 1970-01-01
      • 2020-04-25
      • 2020-04-10
      • 1970-01-01
      相关资源
      最近更新 更多