AWS CLI Cloudformation OperationInProgressException when calling the CreateStackInstances operation












1














I'm using the aws cli to create a cloudformation stackset



echo "creating stackset..."



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 "Waiting for stack instance to be created ..."



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


echo "Creating stack instances..."



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 "Done creating stack instances"



When I wait for the stackset to finish creating before I can create stack instances within that stackset, the cli is supposed to




Wait until stack status is CREATE_COMPLETE. It will poll every 30
seconds until a successful state has been reached. This will exit with
a return code of 255 after 120 failed checks.
https://docs.aws.amazon.com/cli/latest/reference/cloudformation/wait/stack-create-complete.html




However, that's not the behavior i'm observing. As soon as the cli gets to that aws cloudformation wait stack-create-complete... it doesn't wait there for 30 secs as it's supposed to according to the cli doc, instead, it just moves on to the next command (create-stack-instances) which fails with OperationInProgressException any idea why?










share|improve this question





























    1














    I'm using the aws cli to create a cloudformation stackset



    echo "creating stackset..."



    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 "Waiting for stack instance to be created ..."



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


    echo "Creating stack instances..."



    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 "Done creating stack instances"



    When I wait for the stackset to finish creating before I can create stack instances within that stackset, the cli is supposed to




    Wait until stack status is CREATE_COMPLETE. It will poll every 30
    seconds until a successful state has been reached. This will exit with
    a return code of 255 after 120 failed checks.
    https://docs.aws.amazon.com/cli/latest/reference/cloudformation/wait/stack-create-complete.html




    However, that's not the behavior i'm observing. As soon as the cli gets to that aws cloudformation wait stack-create-complete... it doesn't wait there for 30 secs as it's supposed to according to the cli doc, instead, it just moves on to the next command (create-stack-instances) which fails with OperationInProgressException any idea why?










    share|improve this question



























      1












      1








      1


      1





      I'm using the aws cli to create a cloudformation stackset



      echo "creating stackset..."



      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 "Waiting for stack instance to be created ..."



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


      echo "Creating stack instances..."



      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 "Done creating stack instances"



      When I wait for the stackset to finish creating before I can create stack instances within that stackset, the cli is supposed to




      Wait until stack status is CREATE_COMPLETE. It will poll every 30
      seconds until a successful state has been reached. This will exit with
      a return code of 255 after 120 failed checks.
      https://docs.aws.amazon.com/cli/latest/reference/cloudformation/wait/stack-create-complete.html




      However, that's not the behavior i'm observing. As soon as the cli gets to that aws cloudformation wait stack-create-complete... it doesn't wait there for 30 secs as it's supposed to according to the cli doc, instead, it just moves on to the next command (create-stack-instances) which fails with OperationInProgressException any idea why?










      share|improve this question















      I'm using the aws cli to create a cloudformation stackset



      echo "creating stackset..."



      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 "Waiting for stack instance to be created ..."



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


      echo "Creating stack instances..."



      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 "Done creating stack instances"



      When I wait for the stackset to finish creating before I can create stack instances within that stackset, the cli is supposed to




      Wait until stack status is CREATE_COMPLETE. It will poll every 30
      seconds until a successful state has been reached. This will exit with
      a return code of 255 after 120 failed checks.
      https://docs.aws.amazon.com/cli/latest/reference/cloudformation/wait/stack-create-complete.html




      However, that's not the behavior i'm observing. As soon as the cli gets to that aws cloudformation wait stack-create-complete... it doesn't wait there for 30 secs as it's supposed to according to the cli doc, instead, it just moves on to the next command (create-stack-instances) which fails with OperationInProgressException any idea why?







      amazon-web-services amazon-cloudformation aws-cli






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 '18 at 16:04

























      asked Nov 19 '18 at 15:41









      pelican

      1,27431437




      1,27431437
























          1 Answer
          1






          active

          oldest

          votes


















          0














          A Cloudformation stackSet is different from a stack. The waiter you are using aws cloudformation wait stack-create-complete is for stacks, not stackSets. Unfortunately there is no waiter for stackSets at this time, though using a bash loops is not difficult to create your own waiter.






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378108%2faws-cli-cloudformation-operationinprogressexception-when-calling-the-createstack%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            A Cloudformation stackSet is different from a stack. The waiter you are using aws cloudformation wait stack-create-complete is for stacks, not stackSets. Unfortunately there is no waiter for stackSets at this time, though using a bash loops is not difficult to create your own waiter.






            share|improve this answer


























              0














              A Cloudformation stackSet is different from a stack. The waiter you are using aws cloudformation wait stack-create-complete is for stacks, not stackSets. Unfortunately there is no waiter for stackSets at this time, though using a bash loops is not difficult to create your own waiter.






              share|improve this answer
























                0












                0








                0






                A Cloudformation stackSet is different from a stack. The waiter you are using aws cloudformation wait stack-create-complete is for stacks, not stackSets. Unfortunately there is no waiter for stackSets at this time, though using a bash loops is not difficult to create your own waiter.






                share|improve this answer












                A Cloudformation stackSet is different from a stack. The waiter you are using aws cloudformation wait stack-create-complete is for stacks, not stackSets. Unfortunately there is no waiter for stackSets at this time, though using a bash loops is not difficult to create your own waiter.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 25 '18 at 20:14









                cementblocks

                1,470814




                1,470814






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378108%2faws-cli-cloudformation-operationinprogressexception-when-calling-the-createstack%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    MongoDB - Not Authorized To Execute Command

                    How to fix TextFormField cause rebuild widget in Flutter

                    in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith