accounts
Creates, updates, deletes, gets or lists an accounts resource.
Overview
| Name | accounts |
| Type | Resource |
| Id | aws.compute_optimizer_automation.accounts |
Fields
The following fields are returned by SELECT queries:
- list_accounts
| Name | Datatype | Description |
|---|---|---|
account_id | string | The ID of the Amazon Web Services account. (pattern: <code>[0-9]{12}</code>) |
last_updated_timestamp | string (date-time) | The timestamp when the account's Automation enrollment status was last updated. |
organization_rule_mode | string | Specifies whether the management account can create Automation rules that implement optimization actions for this account. (AnyAllowed, NoneAllowed) |
status | string | The enrollment status of the account: Active, Inactive, Pending, or Failed. (Active, Inactive, Pending, Failed) |
status_reason | string | The reason for the current Automation enrollment status. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list_accounts | select | region | 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. | |
associate_accounts | update | region, accountIds | 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. | |
disassociate_accounts | exec | region, accountIds | 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. |
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
- list_accounts
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
- associate_accounts
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
- disassociate_accounts
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 }}"
}'
;