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.
Idawscc.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.

For more information, see AWS::Organizations::Account.

Methods

NameResourceAccessible byRequired Params
create_resourceaccountsINSERTAccountName, Email, region
delete_resourceaccountsDELETEIdentifier, region
update_resourceaccountsUPDATEIdentifier, PatchDocument, region
list_resourcesaccounts_list_onlySELECTregion
get_resourceaccountsSELECTIdentifier, region

SELECT examples

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 awscc.organizations.accounts
WHERE
region = 'us-east-1' AND
Identifier = '{{ account_id }}';

INSERT example

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

/*+ create */
INSERT INTO awscc.organizations.accounts (
AccountName,
Email,
region
)
SELECT
'{{ account_name }}',
'{{ email }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

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

/*+ update */
UPDATE awscc.organizations.accounts
SET PatchDocument = string('{{ {
"AccountName": account_name,
"Email": email,
"RoleName": role_name,
"ParentIds": parent_ids,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ account_id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.organizations.accounts
WHERE
Identifier = '{{ account_id }}' AND
region = 'us-east-1'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

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

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