Cap Barracudas
Cap Barracudas

Reputation: 2515

Set log group retention policy to never expire via clouformation

Can I set a log group retention policy to 'never expire' using cloudformation ? F.e. I have the following template :

CustomLogGroup:
        Type: AWS::Logs::LogGroup
        Properties:
          LogGroupName: "logs"
          RetentionInDays: 3653

The documentation suggests I should use a DeleteRetentionPolicy action . Can I define/perform this action using a yml template ? If yes , how ?

Upvotes: 1

Views: 1941

Answers (1)

Paolo
Paolo

Reputation: 26285

If you don't want your logs to expire, then remove the RetentionInDays property altogether:

CustomLogGroup:
        Type: AWS::Logs::LogGroup
        Properties:
          LogGroupName: "logs"

the default retention will in fact be "Never expire".

The DeleteRetentionPolicy action seems to be something you can run after the log group is created to remove whatever retention policy the log group has.

Upvotes: 1

Related Questions