Skip to content

AWS::Logs::LogGroup

The AWS::Logs::LogGroup resource specifies a log group.

Generated by cfn-typegen --out cfn_types AWS::Logs::LogGroup into cfn_types/logs.py:

# Generated by cfn-typegen from the CloudFormation registry schemas. Do not edit.
# fmt: off
# ruff: noqa
"""AWS::Logs resources."""

from collections.abc import Mapping, Sequence
from typing import Any, Literal, NotRequired, Unpack
from typing_extensions import TypedDict
from cfn_typed.base import DeletionPolicy, DependsOn, ResourceAttrs, Tag, UpdateReplacePolicy, build
from cfn_typed.intrinsics import Expr


CONSTRAINTS:dict[str,Any]={
'AWS::Logs::LogGroup':{'LogGroupName':{'p':"^[.\\-_/#A-Za-z0-9]{1,512}\\Z",'l':1,'L':512},'KmsKeyId':{'p':"^arn:[a-z0-9-]+:kms:[a-z0-9-]+:\\d{12}:(key|alias)/.+\\Z",'L':256},'LogGroupClass':{'e':["STANDARD","INFREQUENT_ACCESS","DELIVERY"]},'RetentionInDays':{'e':[1,3,5,7,14,30,60,90,120,150,180,365,400,545,731,1096,1827,2192,2557,2922,3288,3653]},'Tags':{'T':{'P':{'Key':{'l':1,'L':128},'Value':{'l':0,'L':256}}}}},
}


ATTRIBUTES:dict[str,Any]={"AWS::Logs::LogGroup":["Arn","LogGroupName"]}


RULES:dict[str,Any]={}
Nested types (3)

These are defined above the properties in the generated module.

class LogGroupProps(TypedDict, closed=True):
    'The ``AWS::Logs::LogGroup`` resource specifies a log group.'
    LogGroupName: NotRequired[Expr[str]]
    'The name of the log group.'
    KmsKeyId: NotRequired[Expr[str]]
    'The Amazon Resource Name (ARN) of the KMS key to use when encrypting log data.'
    DataProtectionPolicy: NotRequired[Expr[Mapping[str, Any]]]
    'Creates a data protection policy and assigns it to the log group.'
    FieldIndexPolicies: NotRequired[Expr[Sequence[Expr[Mapping[str, Any]]]]]
    'Creates or updates a *field index policy* for the specified log group.'
    LogGroupClass: NotRequired[Expr[str]]
    'Specifies the log group class for this log group.'
    RetentionInDays: NotRequired[Expr[int]]
    'The number of days to retain the log events in the specified log group.'
    Tags: NotRequired[Expr[Sequence[Expr[Tag]]]]
    'An array of key-value pairs to apply to the log group.'
    ResourcePolicyDocument: NotRequired[Expr[Mapping[str, Any]]]
    'Creates or updates a resource policy for the specified log group that allows other services to put log events to this account.'
    DeletionProtectionEnabled: NotRequired[Expr[bool]]
    'Indicates whether deletion protection is enabled for this log group.'
    BearerTokenAuthenticationEnabled: NotRequired[Expr[bool]]
    'Indicates whether bearer token authentication is enabled for this log group.'


class LogGroup(ResourceAttrs):
    'The ``AWS::Logs::LogGroup`` resource specifies a log group.'
    Type: Literal['AWS::Logs::LogGroup']
    Properties: NotRequired[LogGroupProps]


def log_group(
    *,
    depends_on: DependsOn | None = None,
    deletion_policy: DeletionPolicy | None = None,
    update_replace_policy: UpdateReplacePolicy | None = None,
    condition: str | None = None,
    metadata: dict[str, Any] | None = None,
    **props: Unpack[LogGroupProps],
) -> LogGroup:
    return build('AWS::Logs::LogGroup', props, depends_on, deletion_policy, update_replace_policy, condition, metadata)

Attributes

Read-only values for get_att(logical_id, attribute). They are not accepted as inputs.

  • Arn