Set expiration of CloudWatch Log Group for Lambda Function

You can actually change the log retention time after creating your Lambda in the console, but you need to do it from the CloudWatch console.

If you go to the CloudWatch console and view the Logs (CloudWatch > Log Groups), you will notice that data in the Expire Events After column are links. By clicking on one of those, you can change the expiration.


If you are creating your Lambda through the console, it is not possible to set the log retention accordingly. It is also not possible to set a default retention for all CloudWatch Logs.

The only way you can influence the log retention is through CloudFormation. In that case, you need to deploy you Lambda through CloudFormation and then you can define a matching LogGroup with a custom retention within that template.