Skip to content

Why are my stack instances that are in my CloudFormation stack set stuck in PENDING status?

2 minute read
0

My stack instances that are in my AWS CloudFormation stack sets remain in a PENDING status during an update.

Short description

When you update a stack set, most of the instances update to show the CURRENT status. However, some of the remaining instances in the update might show the PENDING status.

This behavior occurs because of the feature that handles stack set failures in CloudFormation. The feature modifies the ListStackInstances API to show the DETAILED STATUS instead of the STATUS of the stack instances.

Note: Stack set operations include updates to the stack set and deletion of stack instances within a stack set.

The PENDING status occurs when you update a stack set without a specific deployment target for its stack set instances. When there are no the deployment targets, the instances in the PENDING status wait to update with the latest stack set template.

To resolve this issue, use either the CloudFormation console or the AWS Command Line Interface (AWS CLI) to update the stack set.

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

Use the CloudFormation console

When you're updating your stack set, use your current stack template. On the Set deployment options page, enter the AWS account IDs for the account that you used to create your stack set and select the AWS Region. After you update the stack, the instance status changes from OUTDATED to CURRENT.

Use the AWS CLI

Complete the following steps:

  1. Run the following list-stack-instances command to view the instances that're in the PENDING status:
    aws cloudformation list-stack-instances --stack-set-name XXXXXXXXXXXXX
     --filters Name=DETAILED_STATUS,Values=PENDING
    Note: Replace stack-set-name with your stack set name.
  2. Run the following update-stack-set command to update the stack set and associated instances that are in the PENDING status:
    aws cloudformation update-stack-set \
        --stack-set-name my-stack-set \
        --use-previous-template \
        --accounts xxxxxx \
       --regions xxxxxx \
       --administrator-role-arn xxxxxxxxxxxx
    Note: Replace stack-set-name with your stack set name and include your account ID, Region, and administrator role's ARN. The use-previous-template option uses your current stack template to update the stack set.
AWS OFFICIALUpdated 9 months ago
1 Comment

This workaround is awful for anything beyond the most trivial stacksets which can easily have dozens, hundreds, or even thousands of account/region combinations that need to be identified and listed. Directing anyone to do this via the console is just masochistic.

The service itself should have a basic manual retry option for failed/not-tried stackset instances. It also would be great if it had ANY DIAGNOSTICS WHATSOEVER about WHY half the stackset instances just decided to do nothing and hang forever in "PENDING" status. It's absolutely maddening.

For those forced to deal with this, at least direct customers to the CLI where they can properly filter and find the problem account/region combinations (borderline impossible in the awful Console UI) and use the CLI to re-queue them.

replied a year ago