AWS CloudFormation
User Guide (API Version 2010-05-15)


The AWS::Logs::LogGroup resource creates an Amazon CloudWatch Logs log group that defines common properties for log streams, such as their retention and access control rules. Each log stream must belong to one log group.


To declare this entity in your AWS CloudFormation template, use the following syntax:


{ "Type" : "AWS::Logs::LogGroup", "Properties" : { "LogGroupName" : String, "RetentionInDays" : Integer } }


Type: AWS::Logs::LogGroup Properties: LogGroupName: String RetentionInDays: Integer



A name for the log group. If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the log group. For more information, see Name Type.


If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

Required: No

Type: String

Update requires: Replacement


The number of days log events are kept in CloudWatch Logs. When a log event expires, CloudWatch Logs automatically deletes it. For valid values, see PutRetentionPolicy in the Amazon CloudWatch Logs API Reference.

Required: No

Type: Integer

Update requires: No interruption

Return Values


When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the resource name.

For more information about using the Ref function, see Ref.


Fn::GetAtt returns a value for a specified attribute of this type. The following are the available attributes and sample return values.


The Amazon resource name (ARN) of the CloudWatch Logs log group, such as arn:aws:logs:us-east-1:123456789012:log-group:/mystack-testgroup-12ABC1AB12A1:*.

For more information about using Fn::GetAtt, see Fn::GetAtt.


The following example creates a CloudWatch Logs log group that retains events for 7 days.


"myLogGroup": { "Type": "AWS::Logs::LogGroup", "Properties": { "RetentionInDays": 7 } }


myLogGroup: Type: AWS::Logs::LogGroup Properties: RetentionInDays: 7

Additional Information

For an additional sample template, see Amazon CloudWatch Logs Template Snippets.