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:
- 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.
- 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.