选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

UpdateRule - Recycle Bin
此页面尚未翻译为您的语言。 请求翻译

UpdateRule

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.

Request Syntax

PATCH /rules/identifier HTTP/1.1 Content-type: application/json { "Description": "string", "ExcludeResourceTags": [ { "ResourceTagKey": "string", "ResourceTagValue": "string" } ], "ResourceTags": [ { "ResourceTagKey": "string", "ResourceTagValue": "string" } ], "ResourceType": "string", "RetentionPeriod": { "RetentionPeriodUnit": "string", "RetentionPeriodValue": number } }

URI Request Parameters

The request uses the following URI parameters.

identifier

The unique ID of the retention rule.

Pattern: [0-9a-zA-Z]{11}

Required: Yes

Request Body

The request accepts the following data in JSON format.

Description

The retention rule description.

Type: String

Pattern: ^[\S ]{0,255}$

Required: No

ExcludeResourceTags

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

Type: Array of ResourceTag objects

Array Members: Minimum number of 0 items. Maximum number of 5 items.

Required: No

ResourceTags

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

Type: Array of ResourceTag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Required: No

ResourceType
Note

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

Type: String

Valid Values: EBS_SNAPSHOT | EC2_IMAGE

Required: No

RetentionPeriod

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

Type: RetentionPeriod object

Required: No

Response Syntax

HTTP/1.1 200 Content-type: application/json { "Description": "string", "ExcludeResourceTags": [ { "ResourceTagKey": "string", "ResourceTagValue": "string" } ], "Identifier": "string", "LockEndTime": number, "LockState": "string", "ResourceTags": [ { "ResourceTagKey": "string", "ResourceTagValue": "string" } ], "ResourceType": "string", "RetentionPeriod": { "RetentionPeriodUnit": "string", "RetentionPeriodValue": number }, "RuleArn": "string", "Status": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

Description

The retention rule description.

Type: String

Pattern: ^[\S ]{0,255}$

ExcludeResourceTags

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

Type: Array of ResourceTag objects

Array Members: Minimum number of 0 items. Maximum number of 5 items.

Identifier

The unique ID of the retention rule.

Type: String

Pattern: [0-9a-zA-Z]{11}

LockEndTime

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.

Type: Timestamp

LockState

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

Type: String

Valid Values: locked | pending_unlock | unlocked

ResourceTags

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

Type: Array of ResourceTag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

ResourceType

The resource type retained by the retention rule.

Type: String

Valid Values: EBS_SNAPSHOT | EC2_IMAGE

RetentionPeriod

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

Type: RetentionPeriod object

RuleArn

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

Type: String

Length Constraints: Minimum length of 0. Maximum length of 1011.

Pattern: ^arn:aws(-[a-z]{1,3}){0,2}:rbin:[a-z\-0-9]{0,63}:[0-9]{12}:rule/[0-9a-zA-Z]{11}{0,1011}$

Status

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

Type: String

Valid Values: pending | available

Errors

For information about the errors that are common to all actions, see Common Errors.

ConflictException

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

HTTP Status Code: 409

InternalServerException

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

HTTP Status Code: 500

ResourceNotFoundException

The specified resource was not found.

HTTP Status Code: 404

ServiceQuotaExceededException

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

HTTP Status Code: 402

ValidationException

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

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following:

下一主题:

Data Types

上一主题:

UntagResource
隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。