OpenSearchServiceServerless / Client / create_lifecycle_policy

create_lifecycle_policy#

OpenSearchServiceServerless.Client.create_lifecycle_policy(**kwargs)#

Creates a lifecyle policy to be applied to OpenSearch Serverless indexes. Lifecycle policies define the number of days or hours to retain the data on an OpenSearch Serverless index. For more information, see Creating data lifecycle policies.

See also: AWS API Documentation

Request Syntax

response = client.create_lifecycle_policy(
    clientToken='string',
    description='string',
    name='string',
    policy='string',
    type='retention'
)
Parameters:
  • clientToken (string) –

    A unique, case-sensitive identifier to ensure idempotency of the request.

    This field is autopopulated if not provided.

  • description (string) – A description of the lifecycle policy.

  • name (string) –

    [REQUIRED]

    The name of the lifecycle policy.

  • policy (string) –

    [REQUIRED]

    The JSON policy document to use as the content for the lifecycle policy.

  • type (string) –

    [REQUIRED]

    The type of lifecycle policy.

Return type:

dict

Returns:

Response Syntax

{
    'lifecyclePolicyDetail': {
        'createdDate': 123,
        'description': 'string',
        'lastModifiedDate': 123,
        'name': 'string',
        'policy': {...}|[...]|123|123.4|'string'|True|None,
        'policyVersion': 'string',
        'type': 'retention'
    }
}

Response Structure

  • (dict) –

    • lifecyclePolicyDetail (dict) –

      Details about the created lifecycle policy.

      • createdDate (integer) –

        The date the lifecycle policy was created.

      • description (string) –

        The description of the lifecycle policy.

      • lastModifiedDate (integer) –

        The timestamp of when the lifecycle policy was last modified.

      • name (string) –

        The name of the lifecycle policy.

      • policy (document) –

        The JSON policy document without any whitespaces.

      • policyVersion (string) –

        The version of the lifecycle policy.

      • type (string) –

        The type of lifecycle policy.

Exceptions

  • OpenSearchServiceServerless.Client.exceptions.InternalServerException

  • OpenSearchServiceServerless.Client.exceptions.ConflictException

  • OpenSearchServiceServerless.Client.exceptions.ValidationException

  • OpenSearchServiceServerless.Client.exceptions.ServiceQuotaExceededException