CreateAutomationRule
Creates a new automation rule to apply recommended actions to resources based on specified criteria.
Request Syntax
{
"clientToken": "string",
"criteria": {
"ebsVolumeSizeInGib": [
{
"comparison": "string",
"values": [ number ]
}
],
"ebsVolumeType": [
{
"comparison": "string",
"values": [ "string" ]
}
],
"estimatedMonthlySavings": [
{
"comparison": "string",
"values": [ number ]
}
],
"lookBackPeriodInDays": [
{
"comparison": "string",
"values": [ number ]
}
],
"region": [
{
"comparison": "string",
"values": [ "string" ]
}
],
"resourceArn": [
{
"comparison": "string",
"values": [ "string" ]
}
],
"resourceTag": [
{
"comparison": "string",
"key": "string",
"values": [ "string" ]
}
],
"restartNeeded": [
{
"comparison": "string",
"values": [ "string" ]
}
]
},
"description": "string",
"name": "string",
"organizationConfiguration": {
"accountIds": [ "string" ],
"ruleApplyOrder": "string"
},
"priority": "string",
"recommendedActionTypes": [ "string" ],
"ruleType": "string",
"schedule": {
"executionWindowInMinutes": number,
"scheduleExpression": "string",
"scheduleExpressionTimezone": "string"
},
"status": "string",
"tags": [
{
"key": "string",
"value": "string"
}
]
}
Request Parameters
For information about the parameters that are common to all actions, see Common Parameters.
The request accepts the following data in JSON format.
- clientToken
-
A unique identifier to ensure idempotency of the request.
Type: String
Pattern:
[a-zA-Z0-9_-]{1,64}Required: No
- criteria
-
A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time.
Type: Criteria object
Required: No
- description
-
A description of the automation rule.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 1024.
Pattern:
[a-zA-Z0-9_\-\s@\.]*Required: No
- name
-
The name of the automation rule.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 128.
Pattern:
[a-zA-Z0-9_-]*Required: Yes
- organizationConfiguration
-
Configuration for organization-level rules. Required for OrganizationRule type.
Type: OrganizationConfiguration object
Required: No
- priority
-
A string representation of a decimal number between 0 and 1 (having up to 30 digits after the decimal point) that determines the priority of the rule. When multiple rules match the same recommended action, Compute Optimizer assigns the action to the rule with the lowest priority value (highest priority), even if that rule is scheduled to run later than other matching rules.
Type: String
Required: No
- recommendedActionTypes
-
The types of recommended actions this rule will automate.
Type: Array of strings
Valid Values:
SnapshotAndDeleteUnattachedEbsVolume | UpgradeEbsVolumeTypeRequired: Yes
- ruleType
-
The type of rule.
Note
Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.
Type: String
Valid Values:
OrganizationRule | AccountRuleRequired: Yes
- schedule
-
The schedule for when the rule should run.
Type: Schedule object
Required: Yes
- status
-
The status of the rule
Type: String
Valid Values:
Active | InactiveRequired: Yes
-
The tags to associate with the rule.
Type: Array of Tag objects
Array Members: Minimum number of 0 items. Maximum number of 200 items.
Required: No
Response Syntax
{
"createdTimestamp": number,
"criteria": {
"ebsVolumeSizeInGib": [
{
"comparison": "string",
"values": [ number ]
}
],
"ebsVolumeType": [
{
"comparison": "string",
"values": [ "string" ]
}
],
"estimatedMonthlySavings": [
{
"comparison": "string",
"values": [ number ]
}
],
"lookBackPeriodInDays": [
{
"comparison": "string",
"values": [ number ]
}
],
"region": [
{
"comparison": "string",
"values": [ "string" ]
}
],
"resourceArn": [
{
"comparison": "string",
"values": [ "string" ]
}
],
"resourceTag": [
{
"comparison": "string",
"key": "string",
"values": [ "string" ]
}
],
"restartNeeded": [
{
"comparison": "string",
"values": [ "string" ]
}
]
},
"description": "string",
"name": "string",
"organizationConfiguration": {
"accountIds": [ "string" ],
"ruleApplyOrder": "string"
},
"priority": "string",
"recommendedActionTypes": [ "string" ],
"ruleArn": "string",
"ruleId": "string",
"ruleRevision": number,
"ruleType": "string",
"schedule": {
"executionWindowInMinutes": number,
"scheduleExpression": "string",
"scheduleExpressionTimezone": "string"
},
"status": "string",
"tags": [
{
"key": "string",
"value": "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.
- createdTimestamp
-
The timestamp when the automation rule was created.
Type: Timestamp
- criteria
-
A set of conditions that specify which recommended action qualify for implementation. When a rule is active and a recommended action matches these criteria, Compute Optimizer implements the action at the scheduled run time. You can specify up to 20 conditions per filter criteria and 20 values per condition.
Type: Criteria object
- description
-
A description of the automation rule. Can be up to 1024 characters long and contain alphanumeric characters, underscores, hyphens, spaces, and certain special characters.
Type: String
- name
-
The name of the automation rule. Must be 1-128 characters long and contain only alphanumeric characters, underscores, and hyphens.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 128.
Pattern:
[a-zA-Z0-9_-]* - organizationConfiguration
-
Configuration settings for organization-wide rules, including rule application order and target account IDs.
Type: OrganizationConfiguration object
- priority
-
The priority level of the automation rule, used to determine execution order when multiple rules apply to the same resource.
Type: String
- recommendedActionTypes
-
List of recommended action types that this rule can execute, such as SnapshotAndDeleteUnattachedEbsVolume or UpgradeEbsVolumeType.
Type: Array of strings
Valid Values:
SnapshotAndDeleteUnattachedEbsVolume | UpgradeEbsVolumeType - ruleArn
-
The Amazon Resource Name (ARN) of the created rule.
Type: String
Pattern:
arn:aws:compute-optimizer::[0-9]{12}:automation-rule/[a-zA-Z0-9_-]+ - ruleId
-
The unique identifier of the created rule.
Type: String
Pattern:
[0-9A-Za-z]{16} - ruleRevision
-
The revision number of the automation rule. This is incremented each time the rule is updated.
Type: Long
- ruleType
-
The type of automation rule. Can be either OrganizationRule for organization-wide rules or AccountRule for account-specific rules.
Type: String
Valid Values:
OrganizationRule | AccountRule - schedule
-
The schedule configuration for when the automation rule should execute, including cron expression, timezone, and execution window.
Type: Schedule object
- status
-
The current status of the automation rule. Can be Active or Inactive.
Type: String
Valid Values:
Active | Inactive -
A list of key-value pairs used to categorize and organize the automation rule. Maximum of 200 tags allowed.
Type: Array of Tag objects
Array Members: Minimum number of 0 items. Maximum number of 200 items.
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
You do not have sufficient permissions to perform this action.
HTTP Status Code: 400
- ForbiddenException
-
You are not authorized to perform this action.
HTTP Status Code: 400
- IdempotencyTokenInUseException
-
The specified client token is already in use.
HTTP Status Code: 400
- IdempotentParameterMismatchException
-
Exception thrown when the same client token is used with different parameters, indicating a mismatch in idempotent request parameters.
HTTP Status Code: 400
- InternalServerException
-
An internal error occurred while processing the request.
HTTP Status Code: 500
- InvalidParameterValueException
-
One or more parameter values are not valid.
HTTP Status Code: 400
- OptInRequiredException
-
The account must be opted in to Compute Optimizer Automation before performing this action.
HTTP Status Code: 400
- ResourceNotFoundException
-
The specified resource was not found.
HTTP Status Code: 400
- ServiceQuotaExceededException
-
The request would exceed service quotas.
HTTP Status Code: 400
- ServiceUnavailableException
-
The service is temporarily unavailable.
HTTP Status Code: 500
- ThrottlingException
-
The request was denied due to request throttling.
HTTP Status Code: 400
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: