I have this CDK code:
const logGroup = new LogGroup(this, 'MyAppLogGroup', {
logGroupName: 'myapp',
retention: RetentionDays.ONE_DAY
});
When I run cdk deploy
, log group is created in CloudWatch, but when I run cdk destroy
, it's not deleted. Is there some way to enable this?
See https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-logs.LogGroup.html#removalpolicy. You need to set the removalPolicy
of the LogGroup
to DESTROY
as the default one is RETAIN