2022/11/23 - Amazon Recycle Bin - 2 new 4 updated api methods
Changes This release adds support for Rule Lock for Recycle Bin, which allows you to lock retention rules so that they can no longer be modified or deleted.
Locks a retention rule. A locked retention rule can't be modified or deleted.
See also: AWS API Documentation
Request Syntax
client.lock_rule( Identifier='string', LockConfiguration={ 'UnlockDelay': { 'UnlockDelayValue': 123, 'UnlockDelayUnit': 'DAYS' } } )
string
[REQUIRED]
The unique ID of the retention rule.
dict
[REQUIRED]
Information about the retention rule lock configuration.
UnlockDelay (dict) -- [REQUIRED]
Information about the retention rule unlock delay.
UnlockDelayValue (integer) -- [REQUIRED]
The unlock delay period, measured in the unit specified for UnlockDelayUnit .
UnlockDelayUnit (string) -- [REQUIRED]
The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.
dict
Response Syntax
{ 'Identifier': 'string', 'Description': 'string', 'ResourceType': 'EBS_SNAPSHOT'|'EC2_IMAGE', 'RetentionPeriod': { 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, 'ResourceTags': [ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], 'Status': 'pending'|'available', 'LockConfiguration': { 'UnlockDelay': { 'UnlockDelayValue': 123, 'UnlockDelayUnit': 'DAYS' } }, 'LockState': 'locked'|'pending_unlock'|'unlocked' }
Response Structure
(dict) --
Identifier (string) --
The unique ID of the retention rule.
Description (string) --
The retention rule description.
ResourceType (string) --
The resource type retained by the retention rule.
RetentionPeriod (dict) --
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) --
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) --
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
ResourceTags (list) --
Information about the resource tags used to identify resources that are retained by the retention rule.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) --
The tag key.
ResourceTagValue (string) --
The tag value.
Status (string) --
The state of the retention rule. Only retention rules that are in the available state retain resources.
LockConfiguration (dict) --
Information about the retention rule lock configuration.
UnlockDelay (dict) --
Information about the retention rule unlock delay.
UnlockDelayValue (integer) --
The unlock delay period, measured in the unit specified for UnlockDelayUnit .
UnlockDelayUnit (string) --
The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.
LockState (string) --
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 .
Unlocks a retention rule. After a retention rule is unlocked, it can be modified or deleted only after the unlock delay period expires.
See also: AWS API Documentation
Request Syntax
client.unlock_rule( Identifier='string' )
string
[REQUIRED]
The unique ID of the retention rule.
dict
Response Syntax
{ 'Identifier': 'string', 'Description': 'string', 'ResourceType': 'EBS_SNAPSHOT'|'EC2_IMAGE', 'RetentionPeriod': { 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, 'ResourceTags': [ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], 'Status': 'pending'|'available', 'LockConfiguration': { 'UnlockDelay': { 'UnlockDelayValue': 123, 'UnlockDelayUnit': 'DAYS' } }, 'LockState': 'locked'|'pending_unlock'|'unlocked', 'LockEndTime': datetime(2015, 1, 1) }
Response Structure
(dict) --
Identifier (string) --
The unique ID of the retention rule.
Description (string) --
The retention rule description.
ResourceType (string) --
The resource type retained by the retention rule.
RetentionPeriod (dict) --
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) --
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) --
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
ResourceTags (list) --
Information about the resource tags used to identify resources that are retained by the retention rule.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) --
The tag key.
ResourceTagValue (string) --
The tag value.
Status (string) --
The state of the retention rule. Only retention rules that are in the available state retain resources.
LockConfiguration (dict) --
Information about the retention rule lock configuration.
UnlockDelay (dict) --
Information about the retention rule unlock delay.
UnlockDelayValue (integer) --
The unlock delay period, measured in the unit specified for UnlockDelayUnit .
UnlockDelayUnit (string) --
The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.
LockState (string) --
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 .
LockEndTime (datetime) --
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.
{'LockConfiguration': {'UnlockDelay': {'UnlockDelayUnit': 'DAYS', 'UnlockDelayValue': 'integer'}}}Response
{'LockConfiguration': {'UnlockDelay': {'UnlockDelayUnit': 'DAYS', 'UnlockDelayValue': 'integer'}}, 'LockState': 'locked | pending_unlock | unlocked'}
Creates a Recycle Bin retention rule. For more information, see Create Recycle Bin retention rules in the Amazon Elastic Compute Cloud User Guide .
See also: AWS API Documentation
Request Syntax
client.create_rule( RetentionPeriod={ 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, Description='string', Tags=[ { 'Key': 'string', 'Value': 'string' }, ], ResourceType='EBS_SNAPSHOT'|'EC2_IMAGE', ResourceTags=[ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], LockConfiguration={ 'UnlockDelay': { 'UnlockDelayValue': 123, 'UnlockDelayUnit': 'DAYS' } } )
dict
[REQUIRED]
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) -- [REQUIRED]
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) -- [REQUIRED]
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
string
The retention rule description.
list
Information about the tags to assign to the retention rule.
(dict) --
Information about the tags to assign to the retention rule.
Key (string) -- [REQUIRED]
The tag key.
Value (string) -- [REQUIRED]
The tag value.
string
[REQUIRED]
The resource type to be retained by the retention rule. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To retain snapshots, specify EBS_SNAPSHOT . To retain EBS-backed AMIs, specify EC2_IMAGE .
list
Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.
You can add the same tag key and value pair to a maximum or five retention rules.
To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) -- [REQUIRED]
The tag key.
ResourceTagValue (string) --
The tag value.
dict
Information about the retention rule lock configuration.
UnlockDelay (dict) -- [REQUIRED]
Information about the retention rule unlock delay.
UnlockDelayValue (integer) -- [REQUIRED]
The unlock delay period, measured in the unit specified for UnlockDelayUnit .
UnlockDelayUnit (string) -- [REQUIRED]
The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.
dict
Response Syntax
{ 'Identifier': 'string', 'RetentionPeriod': { 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, 'Description': 'string', 'Tags': [ { 'Key': 'string', 'Value': 'string' }, ], 'ResourceType': 'EBS_SNAPSHOT'|'EC2_IMAGE', 'ResourceTags': [ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], 'Status': 'pending'|'available', 'LockConfiguration': { 'UnlockDelay': { 'UnlockDelayValue': 123, 'UnlockDelayUnit': 'DAYS' } }, 'LockState': 'locked'|'pending_unlock'|'unlocked' }
Response Structure
(dict) --
Identifier (string) --
The unique ID of the retention rule.
RetentionPeriod (dict) --
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) --
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) --
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
Description (string) --
The retention rule description.
Tags (list) --
Information about the tags assigned to the retention rule.
(dict) --
Information about the tags to assign to the retention rule.
Key (string) --
The tag key.
Value (string) --
The tag value.
ResourceType (string) --
The resource type retained by the retention rule.
ResourceTags (list) --
Information about the resource tags used to identify resources that are retained by the retention rule.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) --
The tag key.
ResourceTagValue (string) --
The tag value.
Status (string) --
The state of the retention rule. Only retention rules that are in the available state retain resources.
LockConfiguration (dict) --
Information about the retention rule lock configuration.
UnlockDelay (dict) --
Information about the retention rule unlock delay.
UnlockDelayValue (integer) --
The unlock delay period, measured in the unit specified for UnlockDelayUnit .
UnlockDelayUnit (string) --
The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.
LockState (string) --
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 .
{'LockConfiguration': {'UnlockDelay': {'UnlockDelayUnit': 'DAYS', 'UnlockDelayValue': 'integer'}}, 'LockEndTime': 'timestamp', 'LockState': 'locked | pending_unlock | unlocked'}
Gets information about a Recycle Bin retention rule.
See also: AWS API Documentation
Request Syntax
client.get_rule( Identifier='string' )
string
[REQUIRED]
The unique ID of the retention rule.
dict
Response Syntax
{ 'Identifier': 'string', 'Description': 'string', 'ResourceType': 'EBS_SNAPSHOT'|'EC2_IMAGE', 'RetentionPeriod': { 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, 'ResourceTags': [ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], 'Status': 'pending'|'available', 'LockConfiguration': { 'UnlockDelay': { 'UnlockDelayValue': 123, 'UnlockDelayUnit': 'DAYS' } }, 'LockState': 'locked'|'pending_unlock'|'unlocked', 'LockEndTime': datetime(2015, 1, 1) }
Response Structure
(dict) --
Identifier (string) --
The unique ID of the retention rule.
Description (string) --
The retention rule description.
ResourceType (string) --
The resource type retained by the retention rule.
RetentionPeriod (dict) --
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) --
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) --
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
ResourceTags (list) --
Information about the resource tags used to identify resources that are retained by the retention rule.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) --
The tag key.
ResourceTagValue (string) --
The tag value.
Status (string) --
The state of the retention rule. Only retention rules that are in the available state retain resources.
LockConfiguration (dict) --
Information about the retention rule lock configuration.
UnlockDelay (dict) --
Information about the retention rule unlock delay.
UnlockDelayValue (integer) --
The unlock delay period, measured in the unit specified for UnlockDelayUnit .
UnlockDelayUnit (string) --
The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.
LockState (string) --
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 .
LockEndTime (datetime) --
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.
{'LockState': 'locked | pending_unlock | unlocked'}Response
{'Rules': {'LockState': 'locked | pending_unlock | unlocked'}}
Lists the Recycle Bin retention rules in the Region.
See also: AWS API Documentation
Request Syntax
client.list_rules( MaxResults=123, NextToken='string', ResourceType='EBS_SNAPSHOT'|'EC2_IMAGE', ResourceTags=[ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], LockState='locked'|'pending_unlock'|'unlocked' )
integer
The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned NextToken value.
string
The token for the next page of results.
string
[REQUIRED]
The resource type retained by the retention rule. Only retention rules that retain the specified resource type are listed. Currently, only Amazon EBS snapshots and EBS-backed AMIs are supported. To list retention rules that retain snapshots, specify EBS_SNAPSHOT . To list retention rules that retain EBS-backed AMIs, specify EC2_IMAGE .
list
Information about the resource tags used to identify resources that are retained by the retention rule.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) -- [REQUIRED]
The tag key.
ResourceTagValue (string) --
The tag value.
string
The lock state of the retention rules to list. Only retention rules with the specified lock state are returned.
dict
Response Syntax
{ 'Rules': [ { 'Identifier': 'string', 'Description': 'string', 'RetentionPeriod': { 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, 'LockState': 'locked'|'pending_unlock'|'unlocked' }, ], 'NextToken': 'string' }
Response Structure
(dict) --
Rules (list) --
Information about the retention rules.
(dict) --
Information about a Recycle Bin retention rule.
Identifier (string) --
The unique ID of the retention rule.
Description (string) --
The retention rule description.
RetentionPeriod (dict) --
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) --
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) --
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
LockState (string) --
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 .
NextToken (string) --
The token to use to retrieve the next page of results. This value is null when there are no more results to return.
{'LockEndTime': 'timestamp', 'LockState': 'locked | pending_unlock | unlocked'}
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 .
See also: AWS API Documentation
Request Syntax
client.update_rule( Identifier='string', RetentionPeriod={ 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, Description='string', ResourceType='EBS_SNAPSHOT'|'EC2_IMAGE', ResourceTags=[ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ] )
string
[REQUIRED]
The unique ID of the retention rule.
dict
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) -- [REQUIRED]
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) -- [REQUIRED]
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
string
The retention rule description.
string
Note
This parameter is currently not supported. You can't update a retention rule's resource type after creation.
list
Specifies the resource tags to use to identify resources that are to be retained by a tag-level retention rule. For tag-level retention rules, only deleted resources, of the specified resource type, that have one or more of the specified tag key and value pairs are retained. If a resource is deleted, but it does not have any of the specified tag key and value pairs, it is immediately deleted without being retained by the retention rule.
You can add the same tag key and value pair to a maximum or five retention rules.
To create a Region-level retention rule, omit this parameter. A Region-level retention rule does not have any resource tags specified. It retains all deleted resources of the specified resource type in the Region in which the rule is created, even if the resources are not tagged.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) -- [REQUIRED]
The tag key.
ResourceTagValue (string) --
The tag value.
dict
Response Syntax
{ 'Identifier': 'string', 'RetentionPeriod': { 'RetentionPeriodValue': 123, 'RetentionPeriodUnit': 'DAYS' }, 'Description': 'string', 'ResourceType': 'EBS_SNAPSHOT'|'EC2_IMAGE', 'ResourceTags': [ { 'ResourceTagKey': 'string', 'ResourceTagValue': 'string' }, ], 'Status': 'pending'|'available', 'LockState': 'locked'|'pending_unlock'|'unlocked', 'LockEndTime': datetime(2015, 1, 1) }
Response Structure
(dict) --
Identifier (string) --
The unique ID of the retention rule.
RetentionPeriod (dict) --
Information about the retention period for which the retention rule is to retain resources.
RetentionPeriodValue (integer) --
The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit .
RetentionPeriodUnit (string) --
The unit of time in which the retention period is measured. Currently, only DAYS is supported.
Description (string) --
The retention rule description.
ResourceType (string) --
The resource type retained by the retention rule.
ResourceTags (list) --
Information about the resource tags used to identify resources that are retained by the retention rule.
(dict) --
Information about the resource tags used to identify resources that are retained by the retention rule.
ResourceTagKey (string) --
The tag key.
ResourceTagValue (string) --
The tag value.
Status (string) --
The state of the retention rule. Only retention rules that are in the available state retain resources.
LockState (string) --
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 .
LockEndTime (datetime) --
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.