rules
Creates, updates, deletes, gets or lists a rules resource.
Overview
| Name | rules |
| Type | Resource |
| Id | aws.rbin.rules |
Fields
The following fields are returned by SELECT queries:
- get_rule
- list_rules
| Name | Datatype | Description |
|---|---|---|
description | string | The retention rule description. (pattern: <code>^[\S ]{0,255}$</code>) |
exclude_resource_tags | array | [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. |
identifier | string | The unique ID of the retention rule. (pattern: <code>[0-9a-zA-Z]{11}</code>) |
lock_configuration | object | Information about a retention rule lock configuration. |
lock_end_time | string (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_state | string | [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_tags | array | [Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule. |
resource_type | string | The resource type retained by the retention rule. (EBS_SNAPSHOT, EC2_IMAGE, EBS_VOLUME) |
retention_period | object | Information about the retention period for which the retention rule is to retain resources. |
rule_arn | string | The 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>) |
status | string | The state of the retention rule. Only retention rules that are in the available state retain resources. (pending, available) |
| Name | Datatype | Description |
|---|---|---|
description | string | The retention rule description. (pattern: <code>^[\S ]{0,255}$</code>) |
identifier | string | The unique ID of the retention rule. (pattern: <code>[0-9a-zA-Z]{11}</code>) |
lock_state | string | [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) |
retention_period | object | Information about the retention period for which the retention rule is to retain resources. |
rule_arn | string | The 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>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_rule | select | identifier, region | Gets information about a Recycle Bin retention rule. | |
list_rules | select | region | Lists the Recycle Bin retention rules in the Region. | |
create_rule | insert | region, RetentionPeriod, ResourceType | 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. | |
update_rule | update | identifier, region | 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. | |
delete_rule | delete | identifier, region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
identifier | string | The unique ID of the retention rule. |
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_rule
- list_rules
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
;
Lists the Recycle Bin retention rules in the Region.
SELECT
description,
identifier,
lock_state,
retention_period,
rule_arn
FROM aws.rbin.rules
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_rule
- Manifest
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
;
# Description fields are for documentation purposes
- name: rules
props:
- name: region
value: "{{ region }}"
description: Required parameter for the rules resource.
- name: RetentionPeriod
description: |
Information about the retention period for which the retention rule is to retain resources.
value:
RetentionPeriodValue: {{ RetentionPeriodValue }}
RetentionPeriodUnit: "{{ RetentionPeriodUnit }}"
- name: Description
value: "{{ Description }}"
- name: Tags
value:
- Key: "{{ Key }}"
Value: "{{ Value }}"
- name: ResourceType
value: "{{ ResourceType }}"
valid_values: ['EBS_SNAPSHOT', 'EC2_IMAGE', 'EBS_VOLUME']
- name: ResourceTags
value:
- ResourceTagKey: "{{ ResourceTagKey }}"
ResourceTagValue: "{{ ResourceTagValue }}"
- name: LockConfiguration
description: |
Information about a retention rule lock configuration.
value:
UnlockDelay:
UnlockDelayValue: {{ UnlockDelayValue }}
UnlockDelayUnit: "{{ UnlockDelayUnit }}"
- name: ExcludeResourceTags
value:
- ResourceTagKey: "{{ ResourceTagKey }}"
ResourceTagValue: "{{ ResourceTagValue }}"
UPDATE examples
- update_rule
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
- delete_rule
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
;