Skip to main content

accounts

Creates, updates, deletes or gets an account resource or lists accounts in a region

Overview

Nameaccounts
TypeResource
DescriptionYou can use AWS::Organizations::Account to manage accounts in organization.
Idaws.organizations.accounts

Fields

NameDatatypeDescription
account_namestringThe friendly name of the member account.
emailstringThe email address of the owner to assign to the new member account.
role_namestringThe name of an IAM role that AWS Organizations automatically preconfigures in the new member account. Default name is OrganizationAccountAccessRole if not specified.
parent_idsarrayList of parent nodes for the member account. Currently only one parent at a time is supported. Default is root.
tagsarrayA list of tags that you want to attach to the newly created account. For each tag in the list, you must specify both a tag key and a value.
account_idstringIf the account was created successfully, the unique identifier (ID) of the new account.
arnstringThe Amazon Resource Name (ARN) of the account.
joined_methodstringThe method by which the account joined the organization.
joined_timestampstringThe date the account became a part of the organization.
statusstringThe status of the account in the organization.
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTAccountName, Email, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__Identifier, region

SELECT examples

Gets all accounts in a region.

SELECT
region,
account_name,
email,
role_name,
parent_ids,
tags,
account_id,
arn,
joined_method,
joined_timestamp,
status
FROM aws.organizations.accounts
WHERE region = 'us-east-1';

Gets all properties from an individual account.

SELECT
region,
account_name,
email,
role_name,
parent_ids,
tags,
account_id,
arn,
joined_method,
joined_timestamp,
status
FROM aws.organizations.accounts
WHERE region = 'us-east-1' AND data__Identifier = '<AccountId>';

INSERT example

Use the following StackQL query and manifest file to create a new account resource, using stack-deploy.

/*+ create */
INSERT INTO aws.organizations.accounts (
AccountName,
Email,
region
)
SELECT
'{{ AccountName }}',
'{{ Email }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.organizations.accounts
WHERE data__Identifier = '<AccountId>'
AND region = 'us-east-1';

Permissions

To operate on the accounts resource, the following permissions are required:

Create

organizations:CreateAccount,
organizations:DescribeCreateAccountStatus,
organizations:MoveAccount,
organizations:ListParents,
organizations:TagResource,
organizations:DescribeAccount,
organizations:ListTagsForResource

Read

organizations:DescribeAccount,
organizations:ListParents,
organizations:ListTagsForResource

Update

organizations:MoveAccount,
organizations:TagResource,
organizations:UntagResource,
organizations:ListRoots,
organizations:DescribeAccount,
organizations:ListParents,
organizations:ListTagsForResource

Delete

organizations:CloseAccount

List

organizations:ListAccounts