SDK for PHP 3.x

Client: Aws\RecycleBin\RecycleBinClient
Service ID: rbin
Version: 2021-06-15

This page describes the parameters and results for the operations of the Amazon Recycle Bin (2021-06-15), and shows how to use the Aws\RecycleBin\RecycleBinClient object to call the described operations. This documentation is specific to the 2021-06-15 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

CreateRule ( array $params = [] )
Creates a Recycle Bin retention rule.
DeleteRule ( array $params = [] )
Deletes a Recycle Bin retention rule.
GetRule ( array $params = [] )
Gets information about a Recycle Bin retention rule.
ListRules ( array $params = [] )
Lists the Recycle Bin retention rules in the Region.
ListTagsForResource ( array $params = [] )
Lists the tags assigned to a retention rule.
LockRule ( array $params = [] )
Locks a Region-level retention rule.
TagResource ( array $params = [] )
Assigns tags to the specified retention rule.
UnlockRule ( array $params = [] )
Unlocks a retention rule.
UntagResource ( array $params = [] )
Unassigns a tag from a retention rule.
UpdateRule ( array $params = [] )
Updates an existing Recycle Bin retention rule.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

ListRules

Operations

CreateRule

$result = $client->createRule([/* ... */]);
$promise = $client->createRuleAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->createRule([
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>', // REQUIRED
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'LockConfiguration' => [
        'UnlockDelay' => [ // REQUIRED
            'UnlockDelayUnit' => 'DAYS', // REQUIRED
            'UnlockDelayValue' => <integer>, // REQUIRED
        ],
    ],
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>', // REQUIRED
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE', // REQUIRED
    'RetentionPeriod' => [ // REQUIRED
        'RetentionPeriodUnit' => 'DAYS', // REQUIRED
        'RetentionPeriodValue' => <integer>, // REQUIRED
    ],
    'Tags' => [
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
]);

Parameter Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.

You can't specify exclusion tags for tag-level retention rules.

LockConfiguration
Type: LockConfiguration structure

Information about the retention rule lock configuration.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] 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.

ResourceType
Required: Yes
Type: string

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.

RetentionPeriod
Required: Yes
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

Tags
Type: Array of Tag structures

Information about the tags to assign to the retention rule.

Result Syntax

[
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'Identifier' => '<string>',
    'LockConfiguration' => [
        'UnlockDelay' => [
            'UnlockDelayUnit' => 'DAYS',
            'UnlockDelayValue' => <integer>,
        ],
    ],
    'LockState' => 'locked|pending_unlock|unlocked',
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE',
    'RetentionPeriod' => [
        'RetentionPeriodUnit' => 'DAYS',
        'RetentionPeriodValue' => <integer>,
    ],
    'RuleArn' => '<string>',
    'Status' => 'pending|available',
    'Tags' => [
        [
            'Key' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[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
Type: string

The unique ID of the retention rule.

LockConfiguration
Type: LockConfiguration structure

Information about the retention rule lock configuration.

LockState
Type: 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.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
Type: string

The resource type retained by the retention rule.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

RuleArn
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Status
Type: string

The state of the retention rule. Only retention rules that are in the available state retain resources.

Tags
Type: Array of Tag structures

Information about the tags assigned to the retention rule.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

ServiceQuotaExceededException:

The request would cause a service quota for the number of tags per resource to be exceeded.

InternalServerException:

The service could not respond to the request due to an internal problem.

DeleteRule

$result = $client->deleteRule([/* ... */]);
$promise = $client->deleteRuleAsync([/* ... */]);

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

Parameter Syntax

$result = $client->deleteRule([
    'Identifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

The unique ID of the retention rule.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

ValidationException:

One or more of the parameters in the request is not valid.

ConflictException:

The specified retention rule lock request can't be completed.

GetRule

$result = $client->getRule([/* ... */]);
$promise = $client->getRuleAsync([/* ... */]);

Gets information about a Recycle Bin retention rule.

Parameter Syntax

$result = $client->getRule([
    'Identifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

The unique ID of the retention rule.

Result Syntax

[
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'Identifier' => '<string>',
    'LockConfiguration' => [
        'UnlockDelay' => [
            'UnlockDelayUnit' => 'DAYS',
            'UnlockDelayValue' => <integer>,
        ],
    ],
    'LockEndTime' => <DateTime>,
    'LockState' => 'locked|pending_unlock|unlocked',
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE',
    'RetentionPeriod' => [
        'RetentionPeriodUnit' => 'DAYS',
        'RetentionPeriodValue' => <integer>,
    ],
    'RuleArn' => '<string>',
    'Status' => 'pending|available',
]

Result Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[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
Type: string

The unique ID of the retention rule.

LockConfiguration
Type: LockConfiguration structure

Information about the retention rule lock configuration.

LockEndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

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
Type: 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.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
Type: string

The resource type retained by the retention rule.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

RuleArn
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Status
Type: string

The state of the retention rule. Only retention rules that are in the available state retain resources.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

ListRules

$result = $client->listRules([/* ... */]);
$promise = $client->listRulesAsync([/* ... */]);

Lists the Recycle Bin retention rules in the Region.

Parameter Syntax

$result = $client->listRules([
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>', // REQUIRED
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'LockState' => 'locked|pending_unlock|unlocked',
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>', // REQUIRED
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE', // REQUIRED
]);

Parameter Details

Members
ExcludeResourceTags
Type: Array of ResourceTag structures

[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.

LockState
Type: string

The lock state of the retention rules to list. Only retention rules with the specified lock state are returned.

MaxResults
Type: int

The maximum number of results to return with a single call. To retrieve the remaining results, make another call with the returned NextToken value.

NextToken
Type: string

The token for the next page of results.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
Required: Yes
Type: string

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.

Result Syntax

[
    'NextToken' => '<string>',
    'Rules' => [
        [
            'Description' => '<string>',
            'Identifier' => '<string>',
            'LockState' => 'locked|pending_unlock|unlocked',
            'RetentionPeriod' => [
                'RetentionPeriodUnit' => 'DAYS',
                'RetentionPeriodValue' => <integer>,
            ],
            'RuleArn' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

The token to use to retrieve the next page of results. This value is null when there are no more results to return.

Rules
Type: Array of RuleSummary structures

Information about the retention rules.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

InternalServerException:

The service could not respond to the request due to an internal problem.

ListTagsForResource

$result = $client->listTagsForResource([/* ... */]);
$promise = $client->listTagsForResourceAsync([/* ... */]);

Lists the tags assigned to a retention rule.

Parameter Syntax

$result = $client->listTagsForResource([
    'ResourceArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Result Syntax

[
    'Tags' => [
        [
            'Key' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
Tags
Type: Array of Tag structures

Information about the tags assigned to the retention rule.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

LockRule

$result = $client->lockRule([/* ... */]);
$promise = $client->lockRuleAsync([/* ... */]);

Locks a Region-level retention rule. A locked retention rule can't be modified or deleted.

You can't lock tag-level retention rules, or Region-level retention rules that have exclusion tags.

Parameter Syntax

$result = $client->lockRule([
    'Identifier' => '<string>', // REQUIRED
    'LockConfiguration' => [ // REQUIRED
        'UnlockDelay' => [ // REQUIRED
            'UnlockDelayUnit' => 'DAYS', // REQUIRED
            'UnlockDelayValue' => <integer>, // REQUIRED
        ],
    ],
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

The unique ID of the retention rule.

LockConfiguration
Required: Yes
Type: LockConfiguration structure

Information about the retention rule lock configuration.

Result Syntax

[
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'Identifier' => '<string>',
    'LockConfiguration' => [
        'UnlockDelay' => [
            'UnlockDelayUnit' => 'DAYS',
            'UnlockDelayValue' => <integer>,
        ],
    ],
    'LockState' => 'locked|pending_unlock|unlocked',
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE',
    'RetentionPeriod' => [
        'RetentionPeriodUnit' => 'DAYS',
        'RetentionPeriodValue' => <integer>,
    ],
    'RuleArn' => '<string>',
    'Status' => 'pending|available',
]

Result Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[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
Type: string

The unique ID of the retention rule.

LockConfiguration
Type: LockConfiguration structure

Information about the retention rule lock configuration.

LockState
Type: 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.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
Type: string

The resource type retained by the retention rule.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

RuleArn
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Status
Type: string

The state of the retention rule. Only retention rules that are in the available state retain resources.

Errors

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

ValidationException:

One or more of the parameters in the request is not valid.

ConflictException:

The specified retention rule lock request can't be completed.

TagResource

$result = $client->tagResource([/* ... */]);
$promise = $client->tagResourceAsync([/* ... */]);

Assigns tags to the specified retention rule.

Parameter Syntax

$result = $client->tagResource([
    'ResourceArn' => '<string>', // REQUIRED
    'Tags' => [ // REQUIRED
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Tags
Required: Yes
Type: Array of Tag structures

Information about the tags to assign to the retention rule.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

ServiceQuotaExceededException:

The request would cause a service quota for the number of tags per resource to be exceeded.

UnlockRule

$result = $client->unlockRule([/* ... */]);
$promise = $client->unlockRuleAsync([/* ... */]);

Unlocks a retention rule. After a retention rule is unlocked, it can be modified or deleted only after the unlock delay period expires.

Parameter Syntax

$result = $client->unlockRule([
    'Identifier' => '<string>', // REQUIRED
]);

Parameter Details

Members
Identifier
Required: Yes
Type: string

The unique ID of the retention rule.

Result Syntax

[
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'Identifier' => '<string>',
    'LockConfiguration' => [
        'UnlockDelay' => [
            'UnlockDelayUnit' => 'DAYS',
            'UnlockDelayValue' => <integer>,
        ],
    ],
    'LockEndTime' => <DateTime>,
    'LockState' => 'locked|pending_unlock|unlocked',
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE',
    'RetentionPeriod' => [
        'RetentionPeriodUnit' => 'DAYS',
        'RetentionPeriodValue' => <integer>,
    ],
    'RuleArn' => '<string>',
    'Status' => 'pending|available',
]

Result Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[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
Type: string

The unique ID of the retention rule.

LockConfiguration
Type: LockConfiguration structure

Information about the retention rule lock configuration.

LockEndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

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
Type: 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.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
Type: string

The resource type retained by the retention rule.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

RuleArn
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Status
Type: string

The state of the retention rule. Only retention rules that are in the available state retain resources.

Errors

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

ValidationException:

One or more of the parameters in the request is not valid.

ConflictException:

The specified retention rule lock request can't be completed.

UntagResource

$result = $client->untagResource([/* ... */]);
$promise = $client->untagResourceAsync([/* ... */]);

Unassigns a tag from a retention rule.

Parameter Syntax

$result = $client->untagResource([
    'ResourceArn' => '<string>', // REQUIRED
    'TagKeys' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
ResourceArn
Required: Yes
Type: string

The Amazon Resource Name (ARN) of the retention rule.

TagKeys
Required: Yes
Type: Array of strings

The tag keys of the tags to unassign. All tags that have the specified tag key are unassigned.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

UpdateRule

$result = $client->updateRule([/* ... */]);
$promise = $client->updateRuleAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->updateRule([
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>', // REQUIRED
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'Identifier' => '<string>', // REQUIRED
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>', // REQUIRED
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE',
    'RetentionPeriod' => [
        'RetentionPeriodUnit' => 'DAYS', // REQUIRED
        'RetentionPeriodValue' => <integer>, // REQUIRED
    ],
]);

Parameter Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[Region-level retention rules only] Specifies the exclusion tags to use to identify resources that are to be excluded, or ignored, by a Region-level retention rule. Resources that have any of these tags are not retained by the retention rule upon deletion.

You can't specify exclusion tags for tag-level retention rules.

Identifier
Required: Yes
Type: string

The unique ID of the retention rule.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] 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.

ResourceType
Type: string

This parameter is currently not supported. You can't update a retention rule's resource type after creation.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

Result Syntax

[
    'Description' => '<string>',
    'ExcludeResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'Identifier' => '<string>',
    'LockEndTime' => <DateTime>,
    'LockState' => 'locked|pending_unlock|unlocked',
    'ResourceTags' => [
        [
            'ResourceTagKey' => '<string>',
            'ResourceTagValue' => '<string>',
        ],
        // ...
    ],
    'ResourceType' => 'EBS_SNAPSHOT|EC2_IMAGE',
    'RetentionPeriod' => [
        'RetentionPeriodUnit' => 'DAYS',
        'RetentionPeriodValue' => <integer>,
    ],
    'RuleArn' => '<string>',
    'Status' => 'pending|available',
]

Result Details

Members
Description
Type: string

The retention rule description.

ExcludeResourceTags
Type: Array of ResourceTag structures

[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
Type: string

The unique ID of the retention rule.

LockEndTime
Type: timestamp (string|DateTime or anything parsable by strtotime)

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
Type: 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.

ResourceTags
Type: Array of ResourceTag structures

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

ResourceType
Type: string

The resource type retained by the retention rule.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

RuleArn
Type: string

The Amazon Resource Name (ARN) of the retention rule.

Status
Type: string

The state of the retention rule. Only retention rules that are in the available state retain resources.

Errors

ValidationException:

One or more of the parameters in the request is not valid.

InternalServerException:

The service could not respond to the request due to an internal problem.

ResourceNotFoundException:

The specified resource was not found.

ConflictException:

The specified retention rule lock request can't be completed.

ServiceQuotaExceededException:

The request would cause a service quota for the number of tags per resource to be exceeded.

Shapes

ConflictException

Description

The specified retention rule lock request can't be completed.

Members
Message
Type: string
Reason
Type: string

The reason for the exception.

InternalServerException

Description

The service could not respond to the request due to an internal problem.

Members
Message
Type: string

LockConfiguration

Description

Information about a retention rule lock configuration.

Members
UnlockDelay
Required: Yes
Type: UnlockDelay structure

Information about the retention rule unlock delay.

ResourceNotFoundException

Description

The specified resource was not found.

Members
Message
Type: string
Reason
Type: string

The reason for the exception.

ResourceTag

Description

[Tag-level retention rules only] Information about the resource tags used to identify resources that are retained by the retention rule.

Members
ResourceTagKey
Required: Yes
Type: string

The tag key.

ResourceTagValue
Type: string

The tag value.

RetentionPeriod

Description

Information about the retention period for which the retention rule is to retain resources.

Members
RetentionPeriodUnit
Required: Yes
Type: string

The unit of time in which the retention period is measured. Currently, only DAYS is supported.

RetentionPeriodValue
Required: Yes
Type: int

The period value for which the retention rule is to retain resources. The period is measured using the unit specified for RetentionPeriodUnit.

RuleSummary

Description

Information about a Recycle Bin retention rule.

Members
Description
Type: string

The retention rule description.

Identifier
Type: string

The unique ID of the retention rule.

LockState
Type: 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.

RetentionPeriod
Type: RetentionPeriod structure

Information about the retention period for which the retention rule is to retain resources.

RuleArn
Type: string

The Amazon Resource Name (ARN) of the retention rule.

ServiceQuotaExceededException

Description

The request would cause a service quota for the number of tags per resource to be exceeded.

Members
Message
Type: string
Reason
Type: string

The reason for the exception.

Tag

Description

Information about the tags to assign to the retention rule.

Members
Key
Required: Yes
Type: string

The tag key.

Value
Required: Yes
Type: string

The tag value.

UnlockDelay

Description

Information about the retention rule unlock delay. The unlock delay is the period after which a retention rule can be modified or edited after it has been unlocked by a user with the required permissions. The retention rule can't be modified or deleted during the unlock delay.

Members
UnlockDelayUnit
Required: Yes
Type: string

The unit of time in which to measure the unlock delay. Currently, the unlock delay can be measure only in days.

UnlockDelayValue
Required: Yes
Type: int

The unlock delay period, measured in the unit specified for UnlockDelayUnit.

ValidationException

Description

One or more of the parameters in the request is not valid.

Members
Message
Type: string
Reason
Type: string

The reason for the exception.