Skip to main content

lifecycle_policies

Creates, updates, deletes, gets or lists a lifecycle_policies resource.

Overview

Namelifecycle_policies
TypeResource
Idaws.opensearchserverless.lifecycle_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
lifecycle_policy_detailsarrayA list of lifecycle policies matched to the input policy name and policy type.
lifecycle_policy_error_detailsarrayA list of lifecycle policy names and policy types for which retrieval failed.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
batch_get_lifecycle_policyselectregionReturns one or more configured OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.
list_lifecycle_policiesselectregionReturns a list of OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.
create_lifecycle_policyinsertregion, type, name, policyCreates 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.
update_lifecycle_policyupdateregion, type, name, policyVersionUpdates an OpenSearch Serverless access policy. For more information, see Updating data lifecycle policies.
delete_lifecycle_policydeleteregionDeletes an OpenSearch Serverless lifecycle policy. For more information, see Deleting data lifecycle policies.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns one or more configured OpenSearch Serverless lifecycle policies. For more information, see Viewing data lifecycle policies.

SELECT
lifecycle_policy_details,
lifecycle_policy_error_details
FROM aws.opensearchserverless.lifecycle_policies
WHERE region = '{{ region }}' -- required
;

INSERT examples

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.

INSERT INTO aws.opensearchserverless.lifecycle_policies (
type,
name,
description,
policy,
clientToken,
region
)
SELECT
'{{ type }}' /* required */,
'{{ name }}' /* required */,
'{{ description }}',
'{{ policy }}' /* required */,
'{{ clientToken }}',
'{{ region }}'
RETURNING
lifecycle_policy_detail
;

UPDATE examples

Updates an OpenSearch Serverless access policy. For more information, see Updating data lifecycle policies.

UPDATE aws.opensearchserverless.lifecycle_policies
SET
type = '{{ type }}',
name = '{{ name }}',
policyVersion = '{{ policyVersion }}',
description = '{{ description }}',
policy = '{{ policy }}',
clientToken = '{{ clientToken }}'
WHERE
region = '{{ region }}' --required
AND type = '{{ type }}' --required
AND name = '{{ name }}' --required
AND policyVersion = '{{ policyVersion }}' --required
RETURNING
lifecycle_policy_detail;

DELETE examples

Deletes an OpenSearch Serverless lifecycle policy. For more information, see Deleting data lifecycle policies.

DELETE FROM aws.opensearchserverless.lifecycle_policies
WHERE region = '{{ region }}' --required
;