Skip to main content

More Info:

None of your Amazon CloudFormation stacks should be in Failed mode for more than 6 hours. Any failed CloudFormation stacks that are not fixed on time can lead to application downtime, security issues or unexpected costs on your AWS bill.

Risk Level

Informational

Address

Operational Maturity

Compliance Standards

  • APRA CPS 234 (Australia)
  • BSI C5 (Germany)
  • Brazil LGPD
  • CCPA / CPRA (California)
  • CIS Critical Security Controls v8
  • CMMC 2.0
  • CSA Cloud Controls Matrix v4
  • Cloudanix Best Practice
  • DPDPA
  • Digital Operational Resilience Act (EU)
  • Essential 8
  • ISO/IEC 27017
  • ISO/IEC 27018
  • ISO/IEC 27701
  • KSA PDPL
  • MAS Technology Risk Management (Singapore)
  • MITRE ATT&CK (Cloud)
  • NIST SP 800-171
  • NYDFS 23 NYCRR 500
  • SWIFT Customer Security Controls Framework
  • Sarbanes-Oxley IT General Controls
  • StateRAMP
  • UK NCSC Cyber Assessment Framework

Triage and Remediation

Remediation

Using Console

To remediate a CloudFormation stack with a failed status in AWS using the AWS console, follow these steps:
  1. Open the AWS Management Console and navigate to the CloudFormation service.
  2. Select the CloudFormation stack with a failed status that you want to remediate.
  3. Click on the “Events” tab to view the events associated with the stack.
  4. Review the events to identify the root cause of the failure. The event details will provide information on the resource that failed and the reason for the failure.
  5. Once you have identified the root cause of the failure, take the appropriate action to remediate the issue. This may involve updating the CloudFormation template, modifying the resource configuration, or resolving any dependencies or permissions issues.
  6. After making the necessary changes, update the CloudFormation stack by clicking on the “Update Stack” button.
  7. Follow the prompts to upload the updated template and apply the changes to the stack.
  8. Monitor the stack events to ensure that the update is successful and the stack status changes to “CREATE_COMPLETE” or “UPDATE_COMPLETE”.
By following these steps, you can remediate a CloudFormation stack with a failed status in AWS using the AWS console.

To remediate the CloudFormation Stack failed status in AWS using AWS CLI, follow these steps:
  1. Identify the CloudFormation Stack that has a failed status by running the following command in the AWS CLI:
Replace <stack-name> with the name of the CloudFormation Stack that has a failed status.
  1. Check the events associated with the failed stack by running the following command:
This will provide information on the events that led to the failed status of the stack.
  1. Fix any issues that caused the stack to fail. This may involve updating the CloudFormation template or fixing any resource dependencies.
  2. Once the issues are fixed, update the stack by running the following command:
Replace <stack-name> with the name of the CloudFormation Stack that has a failed status, <path-to-template-file> with the path to the updated CloudFormation template file, and <path-to-parameters-file> with the path to the updated parameters file.
  1. Wait for the stack to update and check its status by running the following command:
If the stack status is CREATE_COMPLETE or UPDATE_COMPLETE, then the remediation is successful. If not, repeat steps 2 to 4 until the stack status is successful.
To remediate the “CloudFormation Stacks Should Not Have A Failed Status” misconfiguration in AWS using Python, you can follow the below steps:
  1. First, you need to identify the CloudFormation stack(s) that have a failed status. You can use the boto3 library in Python to get the list of CloudFormation stacks and their status.
  1. Once you have identified the failed stacks, you can delete them using the delete_stack method of the CloudFormation client.
  1. You can also update the CloudFormation template and re-create the stack(s) to remediate the misconfiguration.
Note: Make sure to test the CloudFormation template before updating the stack(s) to avoid any further misconfigurations.
Terraform cannot remediate a failed CloudFormation stack state. CloudFormation stack lifecycle (CREATE_FAILED, UPDATE_ROLLBACK_FAILED, etc.) is not exposed as a Terraform-managed argument, so you cannot express delete-stack or continue-update-rollback in HCL.To fix this finding you must use AWS directly, following the verified CLI remediation:
In Terraform you can only ensure that new infrastructure is defined as Terraform resources instead of CloudFormation stacks so that Terraform, not CloudFormation, owns creation and updates. There is no aws_cloudformation_stack resource argument that corresponds to these CLI operations, so terraform plan will show no drift related to stack failure state.

Additional Reading: