Skip to main content

rules

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

Overview

Namerules
TypeResource
Idaws.rbin.rules

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
descriptionstringThe retention rule description. (pattern: <code>^[\S ]{0,255}$</code>)
exclude_resource_tagsarray[Region-level retention rules only] Information about the exclusion tags used to identify resources that are to be excluded, or ignored, by the retention rule.
identifierstringThe unique ID of the retention rule. (pattern: <code>[0-9a-zA-Z]{11}</code>)
lock_configurationobjectInformation about a retention rule lock configuration.
lock_end_timestring (date-time)The date and time at which the unlock delay is set to expire. Only returned for retention rules that have been unlocked and that are still within the unlock delay period.
lock_statestring[Region-level retention rules only] The lock state for the retention rule. locked - The retention rule is locked and can't be modified or deleted. pending_unlock - The retention rule has been unlocked but it is still within the unlock delay period. The retention rule can be modified or deleted only after the unlock delay period has expired. unlocked - The retention rule is unlocked and it can be modified or deleted by any user with the required permissions. null - The retention rule has never been locked. Once a retention rule has been locked, it can transition between the locked and unlocked states only; it can never transition back to null. (locked, pending_unlock, unlocked)
resource_tagsarray[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.
resource_typestringThe resource type retained by the retention rule. (EBS_SNAPSHOT, EC2_IMAGE, EBS_VOLUME)
retention_periodobjectInformation about the retention period for which the retention rule is to retain resources.
rule_arnstringThe Amazon Resource Name (ARN) of the retention rule. (pattern: <code>^arn:\S+:rbin:[a-z-0-9]{0,63}:[0-9]{12}:rule/[0-9a-zA-Z]{11}{0,1011}$</code>)
statusstringThe state of the retention rule. Only retention rules that are in the available state retain resources. (pending, available)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_ruleselectidentifier, regionGets information about a Recycle Bin retention rule.
list_rulesselectregionLists the Recycle Bin retention rules in the Region.
create_ruleinsertregion, RetentionPeriod, ResourceTypeCreates a Recycle Bin retention rule. You can create two types of retention rules: Tag-level retention rules - These retention rules use resource tags to identify the resources to protect. For each retention rule, you specify one or more tag key and value pairs. Resources (of the specified type) that have at least one of these tag key and value pairs are automatically retained in the Recycle Bin upon deletion. Use this type of retention rule to protect specific resources in your account based on their tags. Region-level retention rules - These retention rules, by default, apply to all of the resources (of the specified type) in the Region, even if the resources are not tagged. However, you can specify exclusion tags to exclude resources that have specific tags. Use this type of retention rule to protect all resources of a specific type in a Region. For more information, see Create Recycle Bin retention rules in the Amazon EBS User Guide.
update_ruleupdateidentifier, regionUpdates an existing Recycle Bin retention rule. You can update a retention rule's description, resource tags, and retention period at any time after creation. You can't update a retention rule's resource type after creation. For more information, see Update Recycle Bin retention rules in the Amazon Elastic Compute Cloud User Guide.
delete_ruledeleteidentifier, regionDeletes a Recycle Bin retention rule. For more information, see Delete Recycle Bin retention rules in the Amazon Elastic Compute Cloud User Guide.

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
identifierstringThe unique ID of the retention rule.
regionstringAWS region (default: us-east-1)

SELECT examples

Gets information about a Recycle Bin retention rule.

SELECT
description,
exclude_resource_tags,
identifier,
lock_configuration,
lock_end_time,
lock_state,
resource_tags,
resource_type,
retention_period,
rule_arn,
status
FROM aws.rbin.rules
WHERE identifier = '{{ identifier }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a Recycle Bin retention rule. You can create two types of retention rules: Tag-level retention rules - These retention rules use resource tags to identify the resources to protect. For each retention rule, you specify one or more tag key and value pairs. Resources (of the specified type) that have at least one of these tag key and value pairs are automatically retained in the Recycle Bin upon deletion. Use this type of retention rule to protect specific resources in your account based on their tags. Region-level retention rules - These retention rules, by default, apply to all of the resources (of the specified type) in the Region, even if the resources are not tagged. However, you can specify exclusion tags to exclude resources that have specific tags. Use this type of retention rule to protect all resources of a specific type in a Region. For more information, see Create Recycle Bin retention rules in the Amazon EBS User Guide.

INSERT INTO aws.rbin.rules (
RetentionPeriod,
Description,
Tags,
ResourceType,
ResourceTags,
LockConfiguration,
ExcludeResourceTags,
region
)
SELECT
'{{ RetentionPeriod }}' /* required */,
'{{ Description }}',
'{{ Tags }}',
'{{ ResourceType }}' /* required */,
'{{ ResourceTags }}',
'{{ LockConfiguration }}',
'{{ ExcludeResourceTags }}',
'{{ region }}'
RETURNING
description,
exclude_resource_tags,
identifier,
lock_configuration,
lock_state,
resource_tags,
resource_type,
retention_period,
rule_arn,
status,
tags
;

UPDATE examples

Updates an existing Recycle Bin retention rule. You can update a retention rule's description, resource tags, and retention period at any time after creation. You can't update a retention rule's resource type after creation. For more information, see Update Recycle Bin retention rules in the Amazon Elastic Compute Cloud User Guide.

UPDATE aws.rbin.rules
SET
RetentionPeriod = '{{ RetentionPeriod }}',
Description = '{{ Description }}',
ResourceType = '{{ ResourceType }}',
ResourceTags = '{{ ResourceTags }}',
ExcludeResourceTags = '{{ ExcludeResourceTags }}'
WHERE
identifier = '{{ identifier }}' --required
AND region = '{{ region }}' --required
RETURNING
description,
exclude_resource_tags,
identifier,
lock_end_time,
lock_state,
resource_tags,
resource_type,
retention_period,
rule_arn,
status;

DELETE examples

Deletes a Recycle Bin retention rule. For more information, see Delete Recycle Bin retention rules in the Amazon Elastic Compute Cloud User Guide.

DELETE FROM aws.rbin.rules
WHERE identifier = '{{ identifier }}' --required
AND region = '{{ region }}' --required
;