Skip to main content

automation_rules

Creates, updates, deletes, gets or lists an automation_rules resource.

Overview​

Nameautomation_rules
TypeResource
Idaws.compute_optimizer_automation.automation_rules

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringThe name of the automation rule. (pattern: <code>[a-zA-Z0-9_-]*</code>)
account_idstringThe 12-digit Amazon Web Services account ID that owns this automation rule. (pattern: <code>[0-9]{12}</code>)
created_timestampstring (date-time)The timestamp when the automation rule was created.
criteriaobjectA 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.
descriptionstringA description of the automation rule.
last_updated_timestampstring (date-time)The timestamp when the automation rule was last updated.
organization_configurationobjectConfiguration settings for organization-wide automation rules.
prioritystringA 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_typesarrayList of recommended action types that this rule can execute.
rule_arnstringThe 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_idstringThe unique identifier of the automation rule. (pattern: <code>[0-9A-Za-z]{16}</code>)
rule_revisioninteger (int64)The revision number of the automation rule.
rule_typestringThe type of automation rule. (OrganizationRule, AccountRule)
scheduleobjectConfiguration for scheduling when automation rules should execute, including timing and execution windows.
statusstringThe current status of the automation rule (Active or Inactive). (Active, Inactive)
tagsarrayThe tags associated with the automation rule.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_automation_ruleselectregionRetrieves details about a specific automation rule.
list_automation_rulesselectregionLists the automation rules that match specified filters.
create_automation_ruleinsertregion, name, ruleType, recommendedActionTypes, schedule, statusCreates a new automation rule to apply recommended actions to resources based on specified criteria.
update_automation_ruleupdateregion, ruleArn, ruleRevisionUpdates an existing automation rule.
delete_automation_ruledeleteregionDeletes 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.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples​

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
;

INSERT examples​

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
;

UPDATE examples​

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​

Deletes an existing automation rule.

DELETE FROM aws.compute_optimizer_automation.automation_rules
WHERE region = '{{ region }}' --required
;