Created
February 19, 2025 17:57
-
-
Save nisanthchunduru/5c73981bd5b80f8c5783dd7a1f845005 to your computer and use it in GitHub Desktop.
AWS Utility Functions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TODO: Migrate to AWS Node SDK V3 | |
const AWS = require('aws-sdk'); | |
const cloudformation = new AWS.CloudFormation()async function disableTerminationProtection(stackNames) { | |
for (const stackName of stackNames) { | |
try { | |
await cloudformation.updateTerminationProtection({ | |
EnableTerminationProtection: false, | |
StackName: stackName, | |
}).promise(); | |
console.log(`Termination protection disabled for stack ${stackName}`); | |
} catch (err) { | |
console.error(`Failed to disable termination protection for stack ${stackName}: ${err}`); | |
} | |
} | |
} | |
// Example usage: | |
// disableTerminationProtection(['stack1', 'stack2', 'stack3']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment