log_group#

State module for managing AWS CloudWatch Log Groups.

async idem_aws.states.aws.cloudwatch.log_group.present(hub, ctx, name: str, resource_id: str = None, kms_key_id: str = None, tags: Dict[str, str] = None, retention_in_days: int = None) Dict[str, Any][source]#

Creates a log group with the specified name.

You can create up to 5000 log groups per account.

You must use the following guidelines when naming a log group:
  • Log group names must be unique within a region for an AWS account.

  • Log group names can be between 1 and 512 characters long.

  • Log group names consist of the following characters: a-z, A-Z, 0-9, ‘_’ (underscore), ‘-’ (hyphen), ‘/’ (forward slash), and ‘.’ (period).

If you associate a AWS Key Management Service (AWS KMS) customer master key (CMK) with the log group, ingested data is encrypted using the CMK. This association is stored as long as the data encrypted with the CMK is still within Amazon CloudWatch Logs. This enables Amazon CloudWatch Logs to decrypt this data whenever it is requested.

If you attempt to associate a CMK with the log group but the CMK does not exist or the CMK is disabled, you will receive an InvalidParameterException error.

Parameters:
  • name (str) – An Idem name of the log group.

  • resource_id (str, Optional) – AWS CloudWatch Log Group Name Prefix.

  • kms_key_id (str, Optional) – The Amazon Resource Name (ARN) of the CMK to use when encrypting log data.

  • tags (dict, Optional) – The key-value pairs to use for the tags. CloudWatch Logs doesn’t support IAM policies that prevent users from assigning specified tags to log groups using the aws:Resource/key-name or aws:TagKeys condition keys. For more information about using tags to control access, see Controlling access to Amazon Web Services resources using tags. Defaults to None.

  • retention_in_days (int, Optional) – The number of days to retain the log events in the specified log group. Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1827, and 3653.

Request Syntax:
[log_group_name]:
  aws.cloudwatch.log_group.present:
    - name: "string"
    - kms_key_id: "string"
    - tags:
        - "string": "string"
Returns:

Dict[str, Any]

Examples

resource_is_present:
  aws.cloudwatch.log_group.present:
    - name: value
    - tags:
         TestKey4: TestValue4
    - kms_key_id: "arn:aws:kms:us-east-1:xxxxxxxxx:key/xxxx-9500-xxxxx"
async idem_aws.states.aws.cloudwatch.log_group.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any][source]#

Deletes the specified cloudwatch log group.

Parameters:
  • name (str) – An Idem name of the Log Group.

  • resource_id (str, Optional) – AWS CloudWatch Log Group Name Prefix. Idem automatically considers this resource being absent if this field is not specified.

Request Syntax:
[log_group_name]:
  aws.cloudwatch.log_group.absent:
    - name: value
    - resource_id: value
Returns:

Dict[str, Any]

Examples

resource_is_absent:
  aws.cloudwatch.log_group.absent:
    - name: value
    - resource_id: value
async idem_aws.states.aws.cloudwatch.log_group.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Lists the AWS CloudWatch Log Groups.

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Returns:

Dict[str, Any]

Examples

$ idem describe aws.cloudwatch.log_group