Skip to content

cannot delete log group with characters

0

Cloud formation created a log group with ${AppName} character in it (https://eu-west-2.console.aws.amazon.com/cloudwatch/home?region=eu-west-2#logsV2:log-groups/log-group/%2Faws%2Fec2%2Finstance%2F%24{AppName}) ... now I cannot delete the group, nor delete the stack. The information in your chat AI point me to create a support ticket... Thank You

asked 9 months ago105 views

2 Answers
0

Force delete did the job

answered 9 months ago

EXPERT

reviewed 9 months ago

0

CloudFormation happily created the log group with that literal name, but the console and stack cleanup then struggle because the name contains characters that weren’t intended to be static. A few important clarifications: • This is a known edge case with CloudFormation + CloudWatch Logs • The resource is valid, but hard to reference and delete cleanly • Deleting the stack fails because CloudFormation can’t reconcile the logical ID ↔ physical name mapping anymore Why “Force delete” worked Force delete bypasses CloudFormation’s dependency tracking and deletes the physical log group directly. That’s safe here because log groups are not stateful resources. How to prevent this next time • Always wrap dynamic names with !Sub explicitly: LogGroupName: !Sub "/aws/ec2/instance/${AppName}" Add a default value for parameters used in names • Avoid putting unresolved parameters in resource names that CloudFormation must later delete • For logs created implicitly (Lambda, ALB, etc.), consider RetentionInDays instead of managing the name yourself

Force delete is the correct escape hatch.

answered 9 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.