Mechanically Deleting a Failed CloudFormation Stack in a Rollback State | by Teri Radichel | Cloud Safety | Oct, 2022 | Infinite Tech

not fairly Mechanically Deleting a Failed CloudFormation Stack in a Rollback State | by Teri Radichel | Cloud Safety | Oct, 2022 will cowl the newest and most present steerage on the subject of the world. door slowly thus you perceive skillfully and appropriately. will development your information proficiently and reliably


ACM.92 Discount of guide actions to implement issues with CloudFormation

It is a continuation of my collection on automating cybersecurity metrics.

I am solely scripting this as a result of I am uninterested in deleting stacks in a reverted state. I do not know why CloudFormation does not do that for you or have higher choices to manage it. That is what I did:

The primary command above does the next:

  • Describe the stack
  • Get state worth
  • Added o true (|| true) to disregard errors
  • Added 2>/dev/null to not print errors, one thing I normally inform individuals to not do, however on this case it is sensible.

The next command checks if the stack is in a ROLLBACK_COMPLETE state and removes the stack whether it is. I assume you waited for the rollback to finish earlier than making an attempt to redeploy a stack. 🙂

Now the issue is… the stack continues to be making an attempt to clear itself. We’ve got to attend till it will get to a state the place we will proceed, or it’d find yourself in a failure state of some kind. The simplest factor might be to attend till the stack just isn’t on this state: DELETE_IN_PROGRESS.

Since I now should test the standing a number of instances, utilizing the abstraction precept I’ve written about many instances on this weblog, I moved the standing test to its personal operate. I additionally realized that I wanted /dev/null in a distinct place to keep away from getting the error message when the stack does not exist.

I then find yourself with this code in my stack deployment operate:

That ought to save me somewhat time no less than.

Now again to what I actually wish to be doing. Testing our consumer’s capability to log in to an EC2 occasion with the important thing we created.

Observe for updates.

Teri Radichel

If you happen to like this story please applaud Y proceed:

Medium: Teri Radichel or Electronic mail Checklist: Teri Radichel
Twitter: @teriradichel or @2ndSightLab
Requests companies through LinkedIn: Teri Radichel or IANS Analysis

© second sight lab 2022

All posts on this collection:

Github repository

_____________________________________________

Creator:

Cybersecurity for executives within the cloud period at Amazon

Do you want cloud safety coaching? 2nd Sight Lab Cloud Safety Coaching

Is your cloud safe? Rent 2nd Sight Lab for a penetration check or safety evaluation.

Do you’ve got a query about cybersecurity or cloud safety? Ask Teri Radichel by scheduling a name with IANS Analysis.

Cybersecurity and Cloud Safety Assets by Teri Radichel: Cybersecurity and cloud safety courses, articles, white papers, shows, and podcasts


I want the article very almost Mechanically Deleting a Failed CloudFormation Stack in a Rollback State | by Teri Radichel | Cloud Safety | Oct, 2022 provides perception to you and is helpful for tallying to your information

Automatically Deleting a Failed CloudFormation Stack in a Rollback State | by Teri Radichel | Cloud Security | Oct, 2022

x