Skip to main content

accounts

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

Overview

Nameaccounts
TypeResource
Idaws.compute_optimizer_automation.accounts

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
account_idstringThe ID of the Amazon Web Services account. (pattern: <code>[0-9]{12}</code>)
last_updated_timestampstring (date-time)The timestamp when the account's Automation enrollment status was last updated.
organization_rule_modestringSpecifies whether the management account can create Automation rules that implement optimization actions for this account. (AnyAllowed, NoneAllowed)
statusstringThe enrollment status of the account: Active, Inactive, Pending, or Failed. (Active, Inactive, Pending, Failed)
status_reasonstringThe reason for the current Automation enrollment status.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_accountsselectregionLists the accounts in your organization that are enrolled in Compute Optimizer and whether they have enabled Automation. Only the management account or a delegated administrator can perform this action.
associate_accountsupdateregion, accountIdsAssociates one or more member accounts with your organization's management account, enabling centralized implementation of optimization actions across those accounts. Once associated, the management account (or a delegated administrator) can apply recommended actions to the member account. When you associate a member account, its organization rule mode is automatically set to "Any allowed," which permits the management account to create Automation rules that automatically apply actions to that account. If the member account has not previously enabled the Automation feature, the association process automatically enables it. Only the management account or a delegated administrator can perform this action.
disassociate_accountsexecregion, accountIdsDisassociates member accounts from your organization's management account, removing centralized automation capabilities. Once disassociated, organization rules no longer apply to the member account, and the management account (or delegated administrator) cannot create Automation rules for that account. Only the management account or a delegated administrator can perform this action.

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

Lists the accounts in your organization that are enrolled in Compute Optimizer and whether they have enabled Automation. Only the management account or a delegated administrator can perform this action.

SELECT
account_id,
last_updated_timestamp,
organization_rule_mode,
status,
status_reason
FROM aws.compute_optimizer_automation.accounts
WHERE region = '{{ region }}' -- required
;

UPDATE examples

Associates one or more member accounts with your organization's management account, enabling centralized implementation of optimization actions across those accounts. Once associated, the management account (or a delegated administrator) can apply recommended actions to the member account. When you associate a member account, its organization rule mode is automatically set to "Any allowed," which permits the management account to create Automation rules that automatically apply actions to that account. If the member account has not previously enabled the Automation feature, the association process automatically enables it. Only the management account or a delegated administrator can perform this action.

UPDATE aws.compute_optimizer_automation.accounts
SET
accountIds = '{{ accountIds }}',
clientToken = '{{ clientToken }}'
WHERE
region = '{{ region }}' --required
AND accountIds = '{{ accountIds }}' --required
RETURNING
account_ids,
errors;

Lifecycle Methods

Disassociates member accounts from your organization's management account, removing centralized automation capabilities. Once disassociated, organization rules no longer apply to the member account, and the management account (or delegated administrator) cannot create Automation rules for that account. Only the management account or a delegated administrator can perform this action.

EXEC aws.compute_optimizer_automation.accounts.disassociate_accounts
@region='{{ region }}' --required
@@json=
'{
"accountIds": "{{ accountIds }}",
"clientToken": "{{ clientToken }}"
}'
;