Skip to content

Create Rule

recyclebin_create_rule R Documentation

Creates a Recycle Bin retention rule

Description

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.

Usage

recyclebin_create_rule(RetentionPeriod, Description, Tags, ResourceType,
  ResourceTags, LockConfiguration, ExcludeResourceTags)

Arguments

RetentionPeriod

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

Description

The retention rule description.

Tags

Information about the tags to assign to the retention rule.

ResourceType

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

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.

LockConfiguration

Information about the retention rule lock configuration.

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.

Value

A list with the following syntax:

list(
  Identifier = "string",
  RetentionPeriod = list(
    RetentionPeriodValue = 123,
    RetentionPeriodUnit = "DAYS"
  ),
  Description = "string",
  Tags = list(
    list(
      Key = "string",
      Value = "string"
    )
  ),
  ResourceType = "EBS_SNAPSHOT"|"EC2_IMAGE",
  ResourceTags = list(
    list(
      ResourceTagKey = "string",
      ResourceTagValue = "string"
    )
  ),
  Status = "pending"|"available",
  LockConfiguration = list(
    UnlockDelay = list(
      UnlockDelayValue = 123,
      UnlockDelayUnit = "DAYS"
    )
  ),
  LockState = "locked"|"pending_unlock"|"unlocked",
  RuleArn = "string",
  ExcludeResourceTags = list(
    list(
      ResourceTagKey = "string",
      ResourceTagValue = "string"
    )
  )
)

Request syntax

svc$create_rule(
  RetentionPeriod = list(
    RetentionPeriodValue = 123,
    RetentionPeriodUnit = "DAYS"
  ),
  Description = "string",
  Tags = list(
    list(
      Key = "string",
      Value = "string"
    )
  ),
  ResourceType = "EBS_SNAPSHOT"|"EC2_IMAGE",
  ResourceTags = list(
    list(
      ResourceTagKey = "string",
      ResourceTagValue = "string"
    )
  ),
  LockConfiguration = list(
    UnlockDelay = list(
      UnlockDelayValue = 123,
      UnlockDelayUnit = "DAYS"
    )
  ),
  ExcludeResourceTags = list(
    list(
      ResourceTagKey = "string",
      ResourceTagValue = "string"
    )
  )
)