AWS Organizations

2019/11/26 - AWS Organizations - 1 new14 updated api methods

Changes  Update organizations client to latest version

DescribeEffectivePolicy (new) Link ¶

Returns the contents of the effective tag policy for the account. The effective tag policy is the aggregation of any tag policies the account inherits, plus any policy directly that is attached to the account.

This action returns information on tag policies only.

For more information on policy inheritance, see How Policy Inheritance Works in the AWS Organizations User Guide.

This operation can be called from any account in the organization.

See also: AWS API Documentation

Request Syntax

client.describe_effective_policy(
    PolicyType='TAG_POLICY',
    TargetId='string'
)
type PolicyType:

string

param PolicyType:

[REQUIRED]

The type of policy that you want information about.

type TargetId:

string

param TargetId:

When you're signed in as the master account, specify the ID of the account that you want details about. Specifying an organization root or OU as the target is not supported.

rtype:

dict

returns:

Response Syntax

{
    'EffectivePolicy': {
        'PolicyContent': 'string',
        'LastUpdatedTimestamp': datetime(2015, 1, 1),
        'TargetId': 'string',
        'PolicyType': 'TAG_POLICY'
    }
}

Response Structure

  • (dict) --

    • EffectivePolicy (dict) --

      The contents of the effective policy.

      • PolicyContent (string) --

        The text content of the policy.

      • LastUpdatedTimestamp (datetime) --

        The time of the last update to this policy.

      • TargetId (string) --

        The account ID of the policy target.

      • PolicyType (string) --

        The policy type.

CreateAccount (updated) Link ¶
Changes (response)
{'CreateAccountStatus': {'FailureReason': {'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'}}}

Creates an AWS account that is automatically a member of the organization whose credentials made the request. This is an asynchronous request that AWS performs in the background. Because CreateAccount operates asynchronously, it can return a successful completion message even though account initialization might still be in progress. You might need to wait a few minutes before you can successfully access the account. To check the status of the request, do one of the following:

  • Use the OperationId response element from this operation to provide as a parameter to the DescribeCreateAccountStatus operation.

  • Check the AWS CloudTrail log for the CreateAccountResult event. For information on using AWS CloudTrail with AWS Organizations, see Monitoring the Activity in Your Organization in the AWS Organizations User Guide.

The user who calls the API to create an account must have the organizations:CreateAccount permission. If you enabled all features in the organization, AWS Organizations creates the required service-linked role named AWSServiceRoleForOrganizations. For more information, see AWS Organizations and Service-Linked Roles in the AWS Organizations User Guide.

AWS Organizations preconfigures the new member account with a role (named OrganizationAccountAccessRole by default) that grants users in the master account administrator permissions in the new member account. Principals in the master account can assume the role. AWS Organizations clones the company name and address information for the new account from the organization's master account.

This operation can be called only from the organization's master account.

For more information about creating accounts, see Creating an AWS Account in Your Organization in the AWS Organizations User Guide.

See also: AWS API Documentation

Request Syntax

client.create_account(
    Email='string',
    AccountName='string',
    RoleName='string',
    IamUserAccessToBilling='ALLOW'|'DENY'
)
type Email:

string

param Email:

[REQUIRED]

The email address of the owner to assign to the new member account. This email address must not already be associated with another AWS account. You must use a valid email address to complete account creation. You can't access the root user of the account or remove an account that was created with an invalid email address.

type AccountName:

string

param AccountName:

[REQUIRED]

The friendly name of the member account.

type RoleName:

string

param RoleName:

(Optional)

The name of an IAM role that AWS Organizations automatically preconfigures in the new member account. This role trusts the master account, allowing users in the master account to assume the role, as permitted by the master account administrator. The role has administrator permissions in the new member account.

If you don't specify this parameter, the role name defaults to OrganizationAccountAccessRole.

For more information about how to use this role to access the member account, see Accessing and Administering the Member Accounts in Your Organization in the AWS Organizations User Guide. Also see steps 2 and 3 in Tutorial: Delegate Access Across AWS Accounts Using IAM Roles in the IAM User Guide.

The regex pattern that is used to validate this parameter. The pattern can include uppercase letters, lowercase letters, digits with no spaces, and any of the following characters: =,.@-

type IamUserAccessToBilling:

string

param IamUserAccessToBilling:

If set to ALLOW, the new account enables IAM users to access account billing information if they have the required permissions. If set to DENY, only the root user of the new account can access account billing information. For more information, see Activating Access to the Billing and Cost Management Console in the AWS Billing and Cost Management User Guide.

If you don't specify this parameter, the value defaults to ALLOW. This value allows IAM users and roles with the required permissions to access billing information for the new account.

rtype:

dict

returns:

Response Syntax

{
    'CreateAccountStatus': {
        'Id': 'string',
        'AccountName': 'string',
        'State': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
        'RequestedTimestamp': datetime(2015, 1, 1),
        'CompletedTimestamp': datetime(2015, 1, 1),
        'AccountId': 'string',
        'GovCloudAccountId': 'string',
        'FailureReason': 'ACCOUNT_LIMIT_EXCEEDED'|'EMAIL_ALREADY_EXISTS'|'INVALID_ADDRESS'|'INVALID_EMAIL'|'CONCURRENT_ACCOUNT_MODIFICATION'|'INTERNAL_FAILURE'|'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'
    }
}

Response Structure

  • (dict) --

    • CreateAccountStatus (dict) --

      A structure that contains details about the request to create an account. This response structure might not be fully populated when you first receive it because account creation is an asynchronous process. You can pass the returned CreateAccountStatus ID as a parameter to DescribeCreateAccountStatus to get status about the progress of the request at later times. You can also check the AWS CloudTrail log for the CreateAccountResult event. For more information, see Monitoring the Activity in Your Organization in the AWS Organizations User Guide.

      • Id (string) --

        The unique identifier (ID) that references this request. You get this value from the response of the initial CreateAccount request to create the account.

        The regex pattern for a create account request ID string requires "car-" followed by from 8 to 32 lower-case letters or digits.

      • AccountName (string) --

        The account name given to the account when it was created.

      • State (string) --

        The status of the request.

      • RequestedTimestamp (datetime) --

        The date and time that the request was made for the account creation.

      • CompletedTimestamp (datetime) --

        The date and time that the account was created and the request completed.

      • AccountId (string) --

        If the account was created successfully, the unique identifier (ID) of the new account.

        The regex pattern for an account ID string requires exactly 12 digits.

      • GovCloudAccountId (string) --

        If the account was created successfully, the unique identifier (ID) of the new account in the AWS GovCloud (US) Region.

      • FailureReason (string) --

        If the request failed, a description of the reason for the failure.

        • ACCOUNT_LIMIT_EXCEEDED: The account could not be created because you have reached the limit on the number of accounts in your organization.

        • EMAIL_ALREADY_EXISTS: The account could not be created because another AWS account with that email address already exists.

        • GOVCLOUD_ACCOUNT_ALREADY_EXISTS: The account in the AWS GovCloud (US) Region could not be created because this Region already includes an account with that email address.

        • INVALID_ADDRESS: The account could not be created because the address you provided is not valid.

        • INVALID_EMAIL: The account could not be created because the email address you provided is not valid.

        • INTERNAL_FAILURE: The account could not be created because of an internal failure. Try again later. If the problem persists, contact AWS Support.

CreateGovCloudAccount (updated) Link ¶
Changes (response)
{'CreateAccountStatus': {'FailureReason': {'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'}}}

This action is available if all of the following are true:

  • You're authorized to create accounts in the AWS GovCloud (US) Region. For more information on the AWS GovCloud (US) Region, see the AWS GovCloud User Guide.

  • You already have an account in the AWS GovCloud (US) Region that is associated with your master account in the commercial Region.

  • You call this action from the master account of your organization in the commercial Region.

  • You have the organizations:CreateGovCloudAccount permission. AWS Organizations creates the required service-linked role named AWSServiceRoleForOrganizations. For more information, see AWS Organizations and Service-Linked Roles in the AWS Organizations User Guide.

AWS automatically enables AWS CloudTrail for AWS GovCloud (US) accounts, but you should also do the following:

  • Verify that AWS CloudTrail is enabled to store logs.

  • Create an S3 bucket for AWS CloudTrail log storage. For more information, see Verifying AWS CloudTrail Is Enabled in the AWS GovCloud User Guide.

You call this action from the master account of your organization in the commercial Region to create a standalone AWS account in the AWS GovCloud (US) Region. After the account is created, the master account of an organization in the AWS GovCloud (US) Region can invite it to that organization. For more information on inviting standalone accounts in the AWS GovCloud (US) to join an organization, see AWS Organizations in the AWS GovCloud User Guide.

Calling CreateGovCloudAccount is an asynchronous request that AWS performs in the background. Because CreateGovCloudAccount operates asynchronously, it can return a successful completion message even though account initialization might still be in progress. You might need to wait a few minutes before you can successfully access the account. To check the status of the request, do one of the following:

  • Use the OperationId response element from this operation to provide as a parameter to the DescribeCreateAccountStatus operation.

  • Check the AWS CloudTrail log for the CreateAccountResult event. For information on using AWS CloudTrail with Organizations, see Monitoring the Activity in Your Organization in the AWS Organizations User Guide.

When you call the CreateGovCloudAccount action, you create two accounts: a standalone account in the AWS GovCloud (US) Region and an associated account in the commercial Region for billing and support purposes. The account in the commercial Region is automatically a member of the organization whose credentials made the request. Both accounts are associated with the same email address.

A role is created in the new account in the commercial Region that allows the master account in the organization in the commercial Region to assume it. An AWS GovCloud (US) account is then created and associated with the commercial account that you just created. A role is created in the new AWS GovCloud (US) account. This role can be assumed by the AWS GovCloud (US) account that is associated with the master account of the commercial organization. For more information and to view a diagram that explains how account access works, see AWS Organizations in the AWS GovCloud User Guide.

For more information about creating accounts, see Creating an AWS Account in Your Organization in the AWS Organizations User Guide.

See also: AWS API Documentation

Request Syntax

client.create_gov_cloud_account(
    Email='string',
    AccountName='string',
    RoleName='string',
    IamUserAccessToBilling='ALLOW'|'DENY'
)
type Email:

string

param Email:

[REQUIRED]

The email address of the owner to assign to the new member account in the commercial Region. This email address must not already be associated with another AWS account. You must use a valid email address to complete account creation. You can't access the root user of the account or remove an account that was created with an invalid email address. Like all request parameters for CreateGovCloudAccount, the request for the email address for the AWS GovCloud (US) account originates from the commercial Region. It does not come from the AWS GovCloud (US) Region.

type AccountName:

string

param AccountName:

[REQUIRED]

The friendly name of the member account.

type RoleName:

string

param RoleName:

(Optional)

The name of an IAM role that AWS Organizations automatically preconfigures in the new member accounts in both the AWS GovCloud (US) Region and in the commercial Region. This role trusts the master account, allowing users in the master account to assume the role, as permitted by the master account administrator. The role has administrator permissions in the new member account.

If you don't specify this parameter, the role name defaults to OrganizationAccountAccessRole.

For more information about how to use this role to access the member account, see Accessing and Administering the Member Accounts in Your Organization in the AWS Organizations User Guide. See also steps 2 and 3 in Tutorial: Delegate Access Across AWS Accounts Using IAM Roles in the IAM User Guide.

The regex pattern that is used to validate this parameter. The pattern can include uppercase letters, lowercase letters, digits with no spaces, and any of the following characters: =,.@-

type IamUserAccessToBilling:

string

param IamUserAccessToBilling:

If set to ALLOW, the new linked account in the commercial Region enables IAM users to access account billing information if they have the required permissions. If set to DENY, only the root user of the new account can access account billing information. For more information, see Activating Access to the Billing and Cost Management Console in the AWS Billing and Cost Management User Guide.

If you don't specify this parameter, the value defaults to ALLOW, and IAM users and roles with the required permissions can access billing information for the new account.

rtype:

dict

returns:

Response Syntax

{
    'CreateAccountStatus': {
        'Id': 'string',
        'AccountName': 'string',
        'State': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
        'RequestedTimestamp': datetime(2015, 1, 1),
        'CompletedTimestamp': datetime(2015, 1, 1),
        'AccountId': 'string',
        'GovCloudAccountId': 'string',
        'FailureReason': 'ACCOUNT_LIMIT_EXCEEDED'|'EMAIL_ALREADY_EXISTS'|'INVALID_ADDRESS'|'INVALID_EMAIL'|'CONCURRENT_ACCOUNT_MODIFICATION'|'INTERNAL_FAILURE'|'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'
    }
}

Response Structure

  • (dict) --

    • CreateAccountStatus (dict) --

      Contains the status about a CreateAccount or CreateGovCloudAccount request to create an AWS account or an AWS GovCloud (US) account in an organization.

      • Id (string) --

        The unique identifier (ID) that references this request. You get this value from the response of the initial CreateAccount request to create the account.

        The regex pattern for a create account request ID string requires "car-" followed by from 8 to 32 lower-case letters or digits.

      • AccountName (string) --

        The account name given to the account when it was created.

      • State (string) --

        The status of the request.

      • RequestedTimestamp (datetime) --

        The date and time that the request was made for the account creation.

      • CompletedTimestamp (datetime) --

        The date and time that the account was created and the request completed.

      • AccountId (string) --

        If the account was created successfully, the unique identifier (ID) of the new account.

        The regex pattern for an account ID string requires exactly 12 digits.

      • GovCloudAccountId (string) --

        If the account was created successfully, the unique identifier (ID) of the new account in the AWS GovCloud (US) Region.

      • FailureReason (string) --

        If the request failed, a description of the reason for the failure.

        • ACCOUNT_LIMIT_EXCEEDED: The account could not be created because you have reached the limit on the number of accounts in your organization.

        • EMAIL_ALREADY_EXISTS: The account could not be created because another AWS account with that email address already exists.

        • GOVCLOUD_ACCOUNT_ALREADY_EXISTS: The account in the AWS GovCloud (US) Region could not be created because this Region already includes an account with that email address.

        • INVALID_ADDRESS: The account could not be created because the address you provided is not valid.

        • INVALID_EMAIL: The account could not be created because the email address you provided is not valid.

        • INTERNAL_FAILURE: The account could not be created because of an internal failure. Try again later. If the problem persists, contact AWS Support.

CreateOrganization (updated) Link ¶
Changes (response)
{'Organization': {'AvailablePolicyTypes': {'Type': {'TAG_POLICY'}}}}

Creates an AWS organization. The account whose user is calling the CreateOrganization operation automatically becomes the master account of the new organization.

This operation must be called using credentials from the account that is to become the new organization's master account. The principal must also have the relevant IAM permissions.

By default (or if you set the FeatureSet parameter to ALL), the new organization is created with all features enabled. In addition, service control policies are automatically enabled in the root. If you instead create the organization supporting only the consolidated billing features, no policy types are enabled by default, and you can't use organization policies.

See also: AWS API Documentation

Request Syntax

client.create_organization(
    FeatureSet='ALL'|'CONSOLIDATED_BILLING'
)
type FeatureSet:

string

param FeatureSet:

Specifies the feature set supported by the new organization. Each feature set supports different levels of functionality.

  • CONSOLIDATED_BILLING: All member accounts have their bills consolidated to and paid by the master account. For more information, see Consolidated billing in the AWS Organizations User Guide. The consolidated billing feature subset isn't available for organizations in the AWS GovCloud (US) Region.

  • ALL: In addition to all the features that consolidated billing feature set supports, the master account can also apply any policy type to any member account in the organization. For more information, see All features in the AWS Organizations User Guide.

rtype:

dict

returns:

Response Syntax

{
    'Organization': {
        'Id': 'string',
        'Arn': 'string',
        'FeatureSet': 'ALL'|'CONSOLIDATED_BILLING',
        'MasterAccountArn': 'string',
        'MasterAccountId': 'string',
        'MasterAccountEmail': 'string',
        'AvailablePolicyTypes': [
            {
                'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
                'Status': 'ENABLED'|'PENDING_ENABLE'|'PENDING_DISABLE'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • Organization (dict) --

      A structure that contains details about the newly created organization.

      • Id (string) --

        The unique identifier (ID) of an organization.

        The regex pattern for an organization ID string requires "o-" followed by from 10 to 32 lower-case letters or digits.

      • Arn (string) --

        The Amazon Resource Name (ARN) of an organization.

        For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

      • FeatureSet (string) --

        Specifies the functionality that currently is available to the organization. If set to "ALL", then all features are enabled and policies can be applied to accounts in the organization. If set to "CONSOLIDATED_BILLING", then only consolidated billing functionality is available. For more information, see Enabling All Features in Your Organization in the AWS Organizations User Guide.

      • MasterAccountArn (string) --

        The Amazon Resource Name (ARN) of the account that is designated as the master account for the organization.

        For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

      • MasterAccountId (string) --

        The unique identifier (ID) of the master account of an organization.

        The regex pattern for an account ID string requires exactly 12 digits.

      • MasterAccountEmail (string) --

        The email address that is associated with the AWS account that is designated as the master account for the organization.

      • AvailablePolicyTypes (list) --

        A list of policy types that are enabled for this organization. For example, if your organization has all features enabled, then service control policies (SCPs) are included in the list.

        • (dict) --

          Contains information about a policy type and its status in the associated root.

          • Type (string) --

            The name of the policy type.

          • Status (string) --

            The status of the policy type as it relates to the associated root. You can attach a policy of the specified type to a root or to an OU or account in that root. To do so, the policy must be available in the organization and enabled for that root.

CreatePolicy (updated) Link ¶
Changes (request, response)
Request
{'Type': {'TAG_POLICY'}}
Response
{'Policy': {'PolicySummary': {'Type': {'TAG_POLICY'}}}}

Creates a policy of a specified type that you can attach to a root, an organizational unit (OU), or an individual AWS account.

For more information about policies and their use, see Managing Organization Policies.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.create_policy(
    Content='string',
    Description='string',
    Name='string',
    Type='SERVICE_CONTROL_POLICY'|'TAG_POLICY'
)
type Content:

string

param Content:

[REQUIRED]

The policy content to add to the new policy. For example, you could create a service control policy (SCP) that specifies the permissions that administrators in attached accounts can delegate to their users, groups, and roles. The string for this SCP must be JSON text. For more information about the SCP syntax, see Service Control Policy Syntax in the AWS Organizations User Guide.

type Description:

string

param Description:

[REQUIRED]

An optional description to assign to the policy.

type Name:

string

param Name:

[REQUIRED]

The friendly name to assign to the policy.

The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

type Type:

string

param Type:

[REQUIRED]

The type of policy to create.

rtype:

dict

returns:

Response Syntax

{
    'Policy': {
        'PolicySummary': {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'Description': 'string',
            'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
            'AwsManaged': True|False
        },
        'Content': 'string'
    }
}

Response Structure

  • (dict) --

    • Policy (dict) --

      A structure that contains details about the newly created policy.

      • PolicySummary (dict) --

        A structure that contains additional details about the policy.

        • Id (string) --

          The unique identifier (ID) of the policy.

          The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the policy.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

        • Name (string) --

          The friendly name of the policy.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • Description (string) --

          The description of the policy.

        • Type (string) --

          The type of policy.

        • AwsManaged (boolean) --

          A Boolean value that indicates whether the specified policy is an AWS managed policy. If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it.

      • Content (string) --

        The text content of the policy.

DescribeCreateAccountStatus (updated) Link ¶
Changes (response)
{'CreateAccountStatus': {'FailureReason': {'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'}}}

Retrieves the current status of an asynchronous request to create an account.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.describe_create_account_status(
    CreateAccountRequestId='string'
)
type CreateAccountRequestId:

string

param CreateAccountRequestId:

[REQUIRED]

Specifies the operationId that uniquely identifies the request. You can get the ID from the response to an earlier CreateAccount request, or from the ListCreateAccountStatus operation.

The regex pattern for a create account request ID string requires "car-" followed by from 8 to 32 lowercase letters or digits.

rtype:

dict

returns:

Response Syntax

{
    'CreateAccountStatus': {
        'Id': 'string',
        'AccountName': 'string',
        'State': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
        'RequestedTimestamp': datetime(2015, 1, 1),
        'CompletedTimestamp': datetime(2015, 1, 1),
        'AccountId': 'string',
        'GovCloudAccountId': 'string',
        'FailureReason': 'ACCOUNT_LIMIT_EXCEEDED'|'EMAIL_ALREADY_EXISTS'|'INVALID_ADDRESS'|'INVALID_EMAIL'|'CONCURRENT_ACCOUNT_MODIFICATION'|'INTERNAL_FAILURE'|'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'
    }
}

Response Structure

  • (dict) --

    • CreateAccountStatus (dict) --

      A structure that contains the current status of an account creation request.

      • Id (string) --

        The unique identifier (ID) that references this request. You get this value from the response of the initial CreateAccount request to create the account.

        The regex pattern for a create account request ID string requires "car-" followed by from 8 to 32 lower-case letters or digits.

      • AccountName (string) --

        The account name given to the account when it was created.

      • State (string) --

        The status of the request.

      • RequestedTimestamp (datetime) --

        The date and time that the request was made for the account creation.

      • CompletedTimestamp (datetime) --

        The date and time that the account was created and the request completed.

      • AccountId (string) --

        If the account was created successfully, the unique identifier (ID) of the new account.

        The regex pattern for an account ID string requires exactly 12 digits.

      • GovCloudAccountId (string) --

        If the account was created successfully, the unique identifier (ID) of the new account in the AWS GovCloud (US) Region.

      • FailureReason (string) --

        If the request failed, a description of the reason for the failure.

        • ACCOUNT_LIMIT_EXCEEDED: The account could not be created because you have reached the limit on the number of accounts in your organization.

        • EMAIL_ALREADY_EXISTS: The account could not be created because another AWS account with that email address already exists.

        • GOVCLOUD_ACCOUNT_ALREADY_EXISTS: The account in the AWS GovCloud (US) Region could not be created because this Region already includes an account with that email address.

        • INVALID_ADDRESS: The account could not be created because the address you provided is not valid.

        • INVALID_EMAIL: The account could not be created because the email address you provided is not valid.

        • INTERNAL_FAILURE: The account could not be created because of an internal failure. Try again later. If the problem persists, contact AWS Support.

DescribeOrganization (updated) Link ¶
Changes (response)
{'Organization': {'AvailablePolicyTypes': {'Type': {'TAG_POLICY'}}}}

Retrieves information about the organization that the user's account belongs to.

This operation can be called from any account in the organization.

See also: AWS API Documentation

Request Syntax

client.describe_organization()
rtype:

dict

returns:

Response Syntax

{
    'Organization': {
        'Id': 'string',
        'Arn': 'string',
        'FeatureSet': 'ALL'|'CONSOLIDATED_BILLING',
        'MasterAccountArn': 'string',
        'MasterAccountId': 'string',
        'MasterAccountEmail': 'string',
        'AvailablePolicyTypes': [
            {
                'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
                'Status': 'ENABLED'|'PENDING_ENABLE'|'PENDING_DISABLE'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • Organization (dict) --

      A structure that contains information about the organization.

      • Id (string) --

        The unique identifier (ID) of an organization.

        The regex pattern for an organization ID string requires "o-" followed by from 10 to 32 lower-case letters or digits.

      • Arn (string) --

        The Amazon Resource Name (ARN) of an organization.

        For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

      • FeatureSet (string) --

        Specifies the functionality that currently is available to the organization. If set to "ALL", then all features are enabled and policies can be applied to accounts in the organization. If set to "CONSOLIDATED_BILLING", then only consolidated billing functionality is available. For more information, see Enabling All Features in Your Organization in the AWS Organizations User Guide.

      • MasterAccountArn (string) --

        The Amazon Resource Name (ARN) of the account that is designated as the master account for the organization.

        For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

      • MasterAccountId (string) --

        The unique identifier (ID) of the master account of an organization.

        The regex pattern for an account ID string requires exactly 12 digits.

      • MasterAccountEmail (string) --

        The email address that is associated with the AWS account that is designated as the master account for the organization.

      • AvailablePolicyTypes (list) --

        A list of policy types that are enabled for this organization. For example, if your organization has all features enabled, then service control policies (SCPs) are included in the list.

        • (dict) --

          Contains information about a policy type and its status in the associated root.

          • Type (string) --

            The name of the policy type.

          • Status (string) --

            The status of the policy type as it relates to the associated root. You can attach a policy of the specified type to a root or to an OU or account in that root. To do so, the policy must be available in the organization and enabled for that root.

DescribePolicy (updated) Link ¶
Changes (response)
{'Policy': {'PolicySummary': {'Type': {'TAG_POLICY'}}}}

Retrieves information about a policy.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.describe_policy(
    PolicyId='string'
)
type PolicyId:

string

param PolicyId:

[REQUIRED]

The unique identifier (ID) of the policy that you want details about. You can get the ID from the ListPolicies or ListPoliciesForTarget operations.

The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lowercase letters or digits.

rtype:

dict

returns:

Response Syntax

{
    'Policy': {
        'PolicySummary': {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'Description': 'string',
            'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
            'AwsManaged': True|False
        },
        'Content': 'string'
    }
}

Response Structure

  • (dict) --

    • Policy (dict) --

      A structure that contains details about the specified policy.

      • PolicySummary (dict) --

        A structure that contains additional details about the policy.

        • Id (string) --

          The unique identifier (ID) of the policy.

          The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the policy.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

        • Name (string) --

          The friendly name of the policy.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • Description (string) --

          The description of the policy.

        • Type (string) --

          The type of policy.

        • AwsManaged (boolean) --

          A Boolean value that indicates whether the specified policy is an AWS managed policy. If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it.

      • Content (string) --

        The text content of the policy.

DisablePolicyType (updated) Link ¶
Changes (request, response)
Request
{'PolicyType': {'TAG_POLICY'}}
Response
{'Root': {'PolicyTypes': {'Type': {'TAG_POLICY'}}}}

Disables an organizational control policy type in a root and detaches all policies of that type from the organization root, OUs, and accounts. A policy of a certain type can be attached to entities in a root only if that type is enabled in the root. After you perform this operation, you no longer can attach policies of the specified type to that root or to any organizational unit (OU) or account in that root. You can undo this by using the EnablePolicyType operation.

This is an asynchronous request that AWS performs in the background. If you disable a policy for a root, it still appears enabled for the organization if all features are enabled for the organization. AWS recommends that you first use ListRoots to see the status of policy types for a specified root, and then use this operation.

This operation can be called only from the organization's master account.

To view the status of available policy types in the organization, use DescribeOrganization.

See also: AWS API Documentation

Request Syntax

client.disable_policy_type(
    RootId='string',
    PolicyType='SERVICE_CONTROL_POLICY'|'TAG_POLICY'
)
type RootId:

string

param RootId:

[REQUIRED]

The unique identifier (ID) of the root in which you want to disable a policy type. You can get the ID from the ListRoots operation.

The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lowercase letters or digits.

type PolicyType:

string

param PolicyType:

[REQUIRED]

The policy type that you want to disable in this root.

rtype:

dict

returns:

Response Syntax

{
    'Root': {
        'Id': 'string',
        'Arn': 'string',
        'Name': 'string',
        'PolicyTypes': [
            {
                'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
                'Status': 'ENABLED'|'PENDING_ENABLE'|'PENDING_DISABLE'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • Root (dict) --

      A structure that shows the root with the updated list of enabled policy types.

      • Id (string) --

        The unique identifier (ID) for the root.

        The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lower-case letters or digits.

      • Arn (string) --

        The Amazon Resource Name (ARN) of the root.

        For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

      • Name (string) --

        The friendly name of the root.

        The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

      • PolicyTypes (list) --

        The types of policies that are currently enabled for the root and therefore can be attached to the root or to its OUs or accounts.

        • (dict) --

          Contains information about a policy type and its status in the associated root.

          • Type (string) --

            The name of the policy type.

          • Status (string) --

            The status of the policy type as it relates to the associated root. You can attach a policy of the specified type to a root or to an OU or account in that root. To do so, the policy must be available in the organization and enabled for that root.

EnablePolicyType (updated) Link ¶
Changes (request, response)
Request
{'PolicyType': {'TAG_POLICY'}}
Response
{'Root': {'PolicyTypes': {'Type': {'TAG_POLICY'}}}}

Enables a policy type in a root. After you enable a policy type in a root, you can attach policies of that type to the root, any organizational unit (OU), or account in that root. You can undo this by using the DisablePolicyType operation.

This is an asynchronous request that AWS performs in the background. AWS recommends that you first use ListRoots to see the status of policy types for a specified root, and then use this operation.

This operation can be called only from the organization's master account.

You can enable a policy type in a root only if that policy type is available in the organization. To view the status of available policy types in the organization, use DescribeOrganization.

See also: AWS API Documentation

Request Syntax

client.enable_policy_type(
    RootId='string',
    PolicyType='SERVICE_CONTROL_POLICY'|'TAG_POLICY'
)
type RootId:

string

param RootId:

[REQUIRED]

The unique identifier (ID) of the root in which you want to enable a policy type. You can get the ID from the ListRoots operation.

The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lowercase letters or digits.

type PolicyType:

string

param PolicyType:

[REQUIRED]

The policy type that you want to enable.

rtype:

dict

returns:

Response Syntax

{
    'Root': {
        'Id': 'string',
        'Arn': 'string',
        'Name': 'string',
        'PolicyTypes': [
            {
                'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
                'Status': 'ENABLED'|'PENDING_ENABLE'|'PENDING_DISABLE'
            },
        ]
    }
}

Response Structure

  • (dict) --

    • Root (dict) --

      A structure that shows the root with the updated list of enabled policy types.

      • Id (string) --

        The unique identifier (ID) for the root.

        The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lower-case letters or digits.

      • Arn (string) --

        The Amazon Resource Name (ARN) of the root.

        For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

      • Name (string) --

        The friendly name of the root.

        The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

      • PolicyTypes (list) --

        The types of policies that are currently enabled for the root and therefore can be attached to the root or to its OUs or accounts.

        • (dict) --

          Contains information about a policy type and its status in the associated root.

          • Type (string) --

            The name of the policy type.

          • Status (string) --

            The status of the policy type as it relates to the associated root. You can attach a policy of the specified type to a root or to an OU or account in that root. To do so, the policy must be available in the organization and enabled for that root.

ListCreateAccountStatus (updated) Link ¶
Changes (response)
{'CreateAccountStatuses': {'FailureReason': {'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'}}}

Lists the account creation requests that match the specified status that is currently being tracked for the organization.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.list_create_account_status(
    States=[
        'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
    ],
    NextToken='string',
    MaxResults=123
)
type States:

list

param States:

A list of one or more states that you want included in the response. If this parameter isn't present, all requests are included in the response.

  • (string) --

type NextToken:

string

param NextToken:

Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

type MaxResults:

integer

param MaxResults:

(Optional) Use this to limit the number of results you want included per page in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

rtype:

dict

returns:

Response Syntax

{
    'CreateAccountStatuses': [
        {
            'Id': 'string',
            'AccountName': 'string',
            'State': 'IN_PROGRESS'|'SUCCEEDED'|'FAILED',
            'RequestedTimestamp': datetime(2015, 1, 1),
            'CompletedTimestamp': datetime(2015, 1, 1),
            'AccountId': 'string',
            'GovCloudAccountId': 'string',
            'FailureReason': 'ACCOUNT_LIMIT_EXCEEDED'|'EMAIL_ALREADY_EXISTS'|'INVALID_ADDRESS'|'INVALID_EMAIL'|'CONCURRENT_ACCOUNT_MODIFICATION'|'INTERNAL_FAILURE'|'GOVCLOUD_ACCOUNT_ALREADY_EXISTS'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • CreateAccountStatuses (list) --

      A list of objects with details about the requests. Certain elements, such as the accountId number, are present in the output only after the account has been successfully created.

      • (dict) --

        Contains the status about a CreateAccount or CreateGovCloudAccount request to create an AWS account or an AWS GovCloud (US) account in an organization.

        • Id (string) --

          The unique identifier (ID) that references this request. You get this value from the response of the initial CreateAccount request to create the account.

          The regex pattern for a create account request ID string requires "car-" followed by from 8 to 32 lower-case letters or digits.

        • AccountName (string) --

          The account name given to the account when it was created.

        • State (string) --

          The status of the request.

        • RequestedTimestamp (datetime) --

          The date and time that the request was made for the account creation.

        • CompletedTimestamp (datetime) --

          The date and time that the account was created and the request completed.

        • AccountId (string) --

          If the account was created successfully, the unique identifier (ID) of the new account.

          The regex pattern for an account ID string requires exactly 12 digits.

        • GovCloudAccountId (string) --

          If the account was created successfully, the unique identifier (ID) of the new account in the AWS GovCloud (US) Region.

        • FailureReason (string) --

          If the request failed, a description of the reason for the failure.

          • ACCOUNT_LIMIT_EXCEEDED: The account could not be created because you have reached the limit on the number of accounts in your organization.

          • EMAIL_ALREADY_EXISTS: The account could not be created because another AWS account with that email address already exists.

          • GOVCLOUD_ACCOUNT_ALREADY_EXISTS: The account in the AWS GovCloud (US) Region could not be created because this Region already includes an account with that email address.

          • INVALID_ADDRESS: The account could not be created because the address you provided is not valid.

          • INVALID_EMAIL: The account could not be created because the email address you provided is not valid.

          • INTERNAL_FAILURE: The account could not be created because of an internal failure. Try again later. If the problem persists, contact AWS Support.

    • NextToken (string) --

      If present, this value indicates that there is more output available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null.

ListPolicies (updated) Link ¶
Changes (request, response)
Request
{'Filter': {'TAG_POLICY'}}
Response
{'Policies': {'Type': {'TAG_POLICY'}}}

Retrieves the list of all policies in an organization of a specified type.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.list_policies(
    Filter='SERVICE_CONTROL_POLICY'|'TAG_POLICY',
    NextToken='string',
    MaxResults=123
)
type Filter:

string

param Filter:

[REQUIRED]

Specifies the type of policy that you want to include in the response.

type NextToken:

string

param NextToken:

Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

type MaxResults:

integer

param MaxResults:

(Optional) Use this to limit the number of results you want included per page in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

rtype:

dict

returns:

Response Syntax

{
    'Policies': [
        {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'Description': 'string',
            'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
            'AwsManaged': True|False
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Policies (list) --

      A list of policies that match the filter criteria in the request. The output list doesn't include the policy contents. To see the content for a policy, see DescribePolicy.

      • (dict) --

        Contains information about a policy, but does not include the content. To see the content of a policy, see DescribePolicy.

        • Id (string) --

          The unique identifier (ID) of the policy.

          The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the policy.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

        • Name (string) --

          The friendly name of the policy.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • Description (string) --

          The description of the policy.

        • Type (string) --

          The type of policy.

        • AwsManaged (boolean) --

          A Boolean value that indicates whether the specified policy is an AWS managed policy. If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it.

    • NextToken (string) --

      If present, this value indicates that there is more output available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null.

ListPoliciesForTarget (updated) Link ¶
Changes (request, response)
Request
{'Filter': {'TAG_POLICY'}}
Response
{'Policies': {'Type': {'TAG_POLICY'}}}

Lists the policies that are directly attached to the specified target root, organizational unit (OU), or account. You must specify the policy type that you want included in the returned list.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.list_policies_for_target(
    TargetId='string',
    Filter='SERVICE_CONTROL_POLICY'|'TAG_POLICY',
    NextToken='string',
    MaxResults=123
)
type TargetId:

string

param TargetId:

[REQUIRED]

The unique identifier (ID) of the root, organizational unit, or account whose policies you want to list.

The regex pattern for a target ID string requires one of the following:

  • Root - A string that begins with "r-" followed by from 4 to 32 lowercase letters or digits.

  • Account - A string that consists of exactly 12 digits.

  • Organizational unit (OU) - A string that begins with "ou-" followed by from 4 to 32 lowercase letters or digits (the ID of the root that the OU is in). This string is followed by a second "-" dash and from 8 to 32 additional lowercase letters or digits.

type Filter:

string

param Filter:

[REQUIRED]

The type of policy that you want to include in the returned list.

type NextToken:

string

param NextToken:

Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

type MaxResults:

integer

param MaxResults:

(Optional) Use this to limit the number of results you want included per page in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

rtype:

dict

returns:

Response Syntax

{
    'Policies': [
        {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'Description': 'string',
            'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
            'AwsManaged': True|False
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Policies (list) --

      The list of policies that match the criteria in the request.

      • (dict) --

        Contains information about a policy, but does not include the content. To see the content of a policy, see DescribePolicy.

        • Id (string) --

          The unique identifier (ID) of the policy.

          The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the policy.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

        • Name (string) --

          The friendly name of the policy.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • Description (string) --

          The description of the policy.

        • Type (string) --

          The type of policy.

        • AwsManaged (boolean) --

          A Boolean value that indicates whether the specified policy is an AWS managed policy. If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it.

    • NextToken (string) --

      If present, this value indicates that there is more output available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null.

ListRoots (updated) Link ¶
Changes (response)
{'Roots': {'PolicyTypes': {'Type': {'TAG_POLICY'}}}}

Lists the roots that are defined in the current organization.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.list_roots(
    NextToken='string',
    MaxResults=123
)
type NextToken:

string

param NextToken:

Use this parameter if you receive a NextToken response in a previous request that indicates that there is more output available. Set it to the value of the previous call's NextToken response to indicate where the output should continue from.

type MaxResults:

integer

param MaxResults:

(Optional) Use this to limit the number of results you want included per page in the response. If you do not include this parameter, it defaults to a value that is specific to the operation. If additional items exist beyond the maximum you specify, the NextToken response element is present and has a value (is not null). Include that value as the NextToken request parameter in the next call to the operation to get the next part of the results. Note that Organizations might return fewer results than the maximum even when there are more results available. You should check NextToken after every operation to ensure that you receive all of the results.

rtype:

dict

returns:

Response Syntax

{
    'Roots': [
        {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'PolicyTypes': [
                {
                    'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
                    'Status': 'ENABLED'|'PENDING_ENABLE'|'PENDING_DISABLE'
                },
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • Roots (list) --

      A list of roots that are defined in an organization.

      • (dict) --

        Contains details about a root. A root is a top-level parent node in the hierarchy of an organization that can contain organizational units (OUs) and accounts. Every root contains every AWS account in the organization. Each root enables the accounts to be organized in a different way and to have different policy types enabled for use in that root.

        • Id (string) --

          The unique identifier (ID) for the root.

          The regex pattern for a root ID string requires "r-" followed by from 4 to 32 lower-case letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the root.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

        • Name (string) --

          The friendly name of the root.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • PolicyTypes (list) --

          The types of policies that are currently enabled for the root and therefore can be attached to the root or to its OUs or accounts.

          • (dict) --

            Contains information about a policy type and its status in the associated root.

            • Type (string) --

              The name of the policy type.

            • Status (string) --

              The status of the policy type as it relates to the associated root. You can attach a policy of the specified type to a root or to an OU or account in that root. To do so, the policy must be available in the organization and enabled for that root.

    • NextToken (string) --

      If present, this value indicates that there is more output available than is included in the current response. Use this value in the NextToken request parameter in a subsequent call to the operation to get the next part of the output. You should repeat this until the NextToken response element comes back as null.

UpdatePolicy (updated) Link ¶
Changes (response)
{'Policy': {'PolicySummary': {'Type': {'TAG_POLICY'}}}}

Updates an existing policy with a new name, description, or content. If you don't supply any parameter, that value remains unchanged. You can't change a policy's type.

This operation can be called only from the organization's master account.

See also: AWS API Documentation

Request Syntax

client.update_policy(
    PolicyId='string',
    Name='string',
    Description='string',
    Content='string'
)
type PolicyId:

string

param PolicyId:

[REQUIRED]

The unique identifier (ID) of the policy that you want to update.

The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lowercase letters or digits.

type Name:

string

param Name:

If provided, the new name for the policy.

The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

type Description:

string

param Description:

If provided, the new description for the policy.

type Content:

string

param Content:

If provided, the new content for the policy. The text must be correctly formatted JSON that complies with the syntax for the policy's type. For more information, see Service Control Policy Syntax in the AWS Organizations User Guide.

rtype:

dict

returns:

Response Syntax

{
    'Policy': {
        'PolicySummary': {
            'Id': 'string',
            'Arn': 'string',
            'Name': 'string',
            'Description': 'string',
            'Type': 'SERVICE_CONTROL_POLICY'|'TAG_POLICY',
            'AwsManaged': True|False
        },
        'Content': 'string'
    }
}

Response Structure

  • (dict) --

    • Policy (dict) --

      A structure that contains details about the updated policy, showing the requested changes.

      • PolicySummary (dict) --

        A structure that contains additional details about the policy.

        • Id (string) --

          The unique identifier (ID) of the policy.

          The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lower-case letters or digits.

        • Arn (string) --

          The Amazon Resource Name (ARN) of the policy.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the AWS Organizations User Guide.

        • Name (string) --

          The friendly name of the policy.

          The regex pattern that is used to validate this parameter is a string of any of the characters in the ASCII character range.

        • Description (string) --

          The description of the policy.

        • Type (string) --

          The type of policy.

        • AwsManaged (boolean) --

          A Boolean value that indicates whether the specified policy is an AWS managed policy. If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it.

      • Content (string) --

        The text content of the policy.