Skip to content

Instantly share code, notes, and snippets.

@nisanthchunduru
Created February 19, 2025 17:57
Show Gist options
  • Save nisanthchunduru/5c73981bd5b80f8c5783dd7a1f845005 to your computer and use it in GitHub Desktop.
Save nisanthchunduru/5c73981bd5b80f8c5783dd7a1f845005 to your computer and use it in GitHub Desktop.
AWS Utility Functions
// 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