automation_rules
Creates, updates, deletes, gets or lists an automation_rules resource.
Overview
| Name | automation_rules |
| Type | Resource |
| Id | aws.compute_optimizer_automation.automation_rules |
Fields
The following fields are returned by SELECT queries:
- get_automation_rule
- list_automation_rules
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the automation rule. (pattern: <code>[a-zA-Z0-9_-]*</code>) |
account_id | string | The 12-digit Amazon Web Services account ID that owns this automation rule. (pattern: <code>[0-9]{12}</code>) |
created_timestamp | string (date-time) | The timestamp when the automation rule was created. |
criteria | object | 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. |
description | string | A description of the automation rule. |
last_updated_timestamp | string (date-time) | The timestamp when the automation rule was last updated. |
organization_configuration | object | Configuration settings for organization-wide automation rules. |
priority | string | 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. |
recommended_action_types | array | List of recommended action types that this rule can execute. |
rule_arn | string | The Amazon Resource Name (ARN) of the automation rule. (pattern: <code>arn:aws:compute-optimizer::[0-9]{12}:automation-rule/[a-zA-Z0-9_-]+</code>) |
rule_id | string | The unique identifier of the automation rule. (pattern: <code>[0-9A-Za-z]{16}</code>) |
rule_revision | integer (int64) | The revision number of the automation rule. |
rule_type | string | The type of automation rule. (OrganizationRule, AccountRule) |
schedule | object | Configuration for scheduling when automation rules should execute, including timing and execution windows. |
status | string | The current status of the automation rule (Active or Inactive). (Active, Inactive) |
tags | array | The tags associated with the automation rule. |
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the automation rule. (pattern: <code>[a-zA-Z0-9_-]*</code>) |
account_id | string | The 12-digit Amazon Web Services account ID that owns this automation rule. (pattern: <code>[0-9]{12}</code>) |
created_timestamp | string (date-time) | The timestamp when the automation rule was created. |
description | string | A description of the automation rule. |
last_updated_timestamp | string (date-time) | The timestamp when the automation rule was last updated. |
organization_configuration | object | Configuration settings for organization-wide automation rules. |
priority | string | 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. |
recommended_action_types | array | List of recommended action types that this rule can execute. |
rule_arn | string | The Amazon Resource Name (ARN) of the automation rule. (pattern: <code>arn:aws:compute-optimizer::[0-9]{12}:automation-rule/[a-zA-Z0-9_-]+</code>) |
rule_id | string | The unique identifier of the automation rule. (pattern: <code>[0-9A-Za-z]{16}</code>) |
rule_revision | integer (int64) | The revision number of the automation rule. |
rule_type | string | The type of automation rule (OrganizationRule or AccountRule). (OrganizationRule, AccountRule) |
schedule | object | Configuration for scheduling when automation rules should execute, including timing and execution windows. |
status | string | The current status of the automation rule (Active or Inactive). (Active, Inactive) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_automation_rule | select | region | Retrieves details about a specific automation rule. | |
list_automation_rules | select | region | Lists the automation rules that match specified filters. | |
create_automation_rule | insert | region, name, ruleType, recommendedActionTypes, schedule, status | Creates a new automation rule to apply recommended actions to resources based on specified criteria. | |
update_automation_rule | update | region, ruleArn, ruleRevision | Updates an existing automation rule. | |
delete_automation_rule | delete | region | Deletes an existing automation rule. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | AWS region (default: us-east-1) |
SELECT examples
- get_automation_rule
- list_automation_rules
Retrieves details about a specific automation rule.
SELECT
name,
account_id,
created_timestamp,
criteria,
description,
last_updated_timestamp,
organization_configuration,
priority,
recommended_action_types,
rule_arn,
rule_id,
rule_revision,
rule_type,
schedule,
status,
tags
FROM aws.compute_optimizer_automation.automation_rules
WHERE region = '{{ region }}' -- required
;
Lists the automation rules that match specified filters.
SELECT
name,
account_id,
created_timestamp,
description,
last_updated_timestamp,
organization_configuration,
priority,
recommended_action_types,
rule_arn,
rule_id,
rule_revision,
rule_type,
schedule,
status
FROM aws.compute_optimizer_automation.automation_rules
WHERE region = '{{ region }}' -- required
;
INSERT examples
- create_automation_rule
- Manifest
Creates a new automation rule to apply recommended actions to resources based on specified criteria.
INSERT INTO aws.compute_optimizer_automation.automation_rules (
name,
description,
ruleType,
organizationConfiguration,
priority,
recommendedActionTypes,
criteria,
schedule,
status,
tags,
clientToken,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ ruleType }}' /* required */,
'{{ organizationConfiguration }}',
'{{ priority }}',
'{{ recommendedActionTypes }}' /* required */,
'{{ criteria }}',
'{{ schedule }}' /* required */,
'{{ status }}' /* required */,
'{{ tags }}',
'{{ clientToken }}',
'{{ region }}'
RETURNING
name,
created_timestamp,
criteria,
description,
organization_configuration,
priority,
recommended_action_types,
rule_arn,
rule_id,
rule_revision,
rule_type,
schedule,
status,
tags
;
# Description fields are for documentation purposes
- name: automation_rules
props:
- name: region
value: "{{ region }}"
description: Required parameter for the automation_rules resource.
- name: name
value: "{{ name }}"
description: |
The name of the automation rule.
- name: description
value: "{{ description }}"
description: |
A description of the automation rule.
- name: ruleType
value: "{{ ruleType }}"
description: |
The type of rule. Only the management account or a delegated administrator can set the ruleType to be OrganizationRule.
valid_values: ['OrganizationRule', 'AccountRule']
- name: organizationConfiguration
description: |
Configuration for organization-level rules. Required for OrganizationRule type.
value:
ruleApplyOrder: "{{ ruleApplyOrder }}"
accountIds:
- "{{ accountIds }}"
- name: priority
value: "{{ priority }}"
description: |
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.
- name: recommendedActionTypes
value:
- "{{ recommendedActionTypes }}"
description: |
The types of recommended actions this rule will automate.
- name: criteria
description: |
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.
value:
region:
- comparison: "{{ comparison }}"
values: "{{ values }}"
resourceArn:
- comparison: "{{ comparison }}"
values: "{{ values }}"
ebsVolumeType:
- comparison: "{{ comparison }}"
values: "{{ values }}"
ebsVolumeSizeInGib:
- comparison: "{{ comparison }}"
values: "{{ values }}"
estimatedMonthlySavings:
- comparison: "{{ comparison }}"
values: "{{ values }}"
resourceTag:
- comparison: "{{ comparison }}"
key: "{{ key }}"
values: "{{ values }}"
lookBackPeriodInDays:
- comparison: "{{ comparison }}"
values: "{{ values }}"
restartNeeded:
- comparison: "{{ comparison }}"
values: "{{ values }}"
- name: schedule
description: |
The schedule for when the rule should run.
value:
scheduleExpression: "{{ scheduleExpression }}"
scheduleExpressionTimezone: "{{ scheduleExpressionTimezone }}"
executionWindowInMinutes: {{ executionWindowInMinutes }}
- name: status
value: "{{ status }}"
description: |
The status of the rule
valid_values: ['Active', 'Inactive']
- name: tags
description: |
The tags to associate with the rule.
value:
- key: "{{ key }}"
value: "{{ value }}"
- name: clientToken
value: "{{ clientToken }}"
description: |
A unique identifier to ensure idempotency of the request.
UPDATE examples
- update_automation_rule
Updates an existing automation rule.
UPDATE aws.compute_optimizer_automation.automation_rules
SET
ruleArn = '{{ ruleArn }}',
ruleRevision = {{ ruleRevision }},
name = '{{ name }}',
description = '{{ description }}',
ruleType = '{{ ruleType }}',
organizationConfiguration = '{{ organizationConfiguration }}',
priority = '{{ priority }}',
recommendedActionTypes = '{{ recommendedActionTypes }}',
criteria = '{{ criteria }}',
schedule = '{{ schedule }}',
status = '{{ status }}',
clientToken = '{{ clientToken }}'
WHERE
region = '{{ region }}' --required
AND ruleArn = '{{ ruleArn }}' --required
AND ruleRevision = '{{ ruleRevision }}' --required
RETURNING
name,
created_timestamp,
criteria,
description,
last_updated_timestamp,
organization_configuration,
priority,
recommended_action_types,
rule_arn,
rule_revision,
rule_type,
schedule,
status;
DELETE examples
- delete_automation_rule
Deletes an existing automation rule.
DELETE FROM aws.compute_optimizer_automation.automation_rules
WHERE region = '{{ region }}' --required
;