The AWS SDK for JavaScript v2 has reached end-of-support.
We recommend that you migrate to AWS SDK for JavaScript v3. For additional details and information on how to migrate, please refer to the announcement.

Class: AWS.Organizations

Inherits:
AWS.Service show all
Identifier:
organizations
API Version:
2016-11-28
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

Organizations is a web service that enables you to consolidate your multiple Amazon Web Services accounts into an organization and centrally manage your accounts and their resources.

This guide provides descriptions of the Organizations operations. For more information about using this service, see the Organizations User Guide.

Support and feedback for Organizations

We welcome your feedback. Send your comments to feedback-awsorganizations@amazon.com or post your feedback and questions in the Organizations support forum. For more information about the Amazon Web Services support forums, see Forums Help.

Endpoint to call When using the CLI or the Amazon Web Services SDK

For the current release of Organizations, specify the us-east-1 region for all Amazon Web Services API and CLI calls made from the commercial Amazon Web Services Regions outside of China. If calling from one of the Amazon Web Services Regions in China, then specify cn-northwest-1. You can do this in the CLI by using these parameters and commands:

  • Use the following parameter with each command to specify both the endpoint and its region:

    --endpoint-url https://organizations.us-east-1.amazonaws.com (from commercial Amazon Web Services Regions outside of China)

    or

    --endpoint-url https://organizations.cn-northwest-1.amazonaws.com.cn (from Amazon Web Services Regions in China)

  • Use the default endpoint, but configure your default region with this command:

    aws configure set default.region us-east-1 (from commercial Amazon Web Services Regions outside of China)

    or

    aws configure set default.region cn-northwest-1 (from Amazon Web Services Regions in China)

  • Use the following parameter with each command to specify the endpoint:

    --region us-east-1 (from commercial Amazon Web Services Regions outside of China)

    or

    --region cn-northwest-1 (from Amazon Web Services Regions in China)

Recording API Requests

Organizations supports CloudTrail, a service that records Amazon Web Services API calls for your Amazon Web Services account and delivers log files to an Amazon S3 bucket. By using information collected by CloudTrail, you can determine which requests the Organizations service received, who made the request and when, and so on. For more about Organizations and its support for CloudTrail, see Logging Organizations API calls with CloudTrail in the Organizations User Guide. To learn more about CloudTrail, including how to turn it on and find your log files, see the CloudTrail User Guide.

Sending a Request Using Organizations

var organizations = new AWS.Organizations();
organizations.listPoliciesForTarget(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the Organizations object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var organizations = new AWS.Organizations({apiVersion: '2016-11-28'});

You can also set the API version globally in AWS.config.apiVersions using the organizations service identifier:

AWS.config.apiVersions = {
  organizations: '2016-11-28',
  // other service API versions
};

var organizations = new AWS.Organizations();

Version:

  • 2016-11-28

Constructor Summary collapse

Property Summary collapse

Properties inherited from AWS.Service

apiVersions

Method Summary collapse

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.Organizations(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a Organizations object

var organizations = new AWS.Organizations({apiVersion: '2016-11-28'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String|AWS.Endpoint)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com' or an Endpoint object.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.Organizations.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.Organizations.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.Organizations.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • s3UsEast1RegionalEndpoint ('legacy'|'regional')

    when region is set to 'us-east-1', whether to send s3 request to global endpoints or 'us-east-1' regional endpoints. This config is only applicable to S3 client. Defaults to legacy

  • s3UseArnRegion (Boolean)

    whether to override the request region with the region inferred from requested resource's ARN. Only available for S3 buckets Defaults to true

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and error and returns the amount of time to delay in milliseconds. If the result is a non-zero negative value, no further retry attempts will be made. The base option will be ignored if this option is supplied. The function is only called for retryable errors.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean|undefined)

    whether to call operations with endpoints given by service dynamically. Setting this

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

  • stsRegionalEndpoints ('legacy'|'regional')

    whether to send sts request to global endpoints or regional endpoints. Defaults to 'legacy'.

  • useFipsEndpoint (Boolean)

    Enables FIPS compatible endpoints. Defaults to false.

  • useDualstackEndpoint (Boolean)

    Enables IPv6 dualstack endpoint. Defaults to false.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

acceptHandshake(params = {}, callback) ⇒ AWS.Request

Sends a response to the originator of a handshake agreeing to the action proposed by the handshake request.

You can only call this operation by the following principals when they also have the relevant IAM permissions:

  • Invitation to join or Approve all features request handshakes: only a principal from the member account.

    The user who calls the API for an invitation to join must have the organizations:AcceptHandshake permission. If you enabled all features in the organization, the user must also have the iam:CreateServiceLinkedRole permission so that Organizations can create the required service-linked role named AWSServiceRoleForOrganizations. For more information, see Organizations and service-linked roles in the Organizations User Guide.

  • Enable all features final confirmation handshake: only a principal from the management account.

    For more information about invitations, see Inviting an Amazon Web Services account to join your organization in the Organizations User Guide. For more information about requests to enable all features in the organization, see Enabling all features in your organization in the Organizations User Guide.

After you accept a handshake, it continues to appear in the results of relevant APIs for only 30 days. After that, it's deleted.

Service Reference:

Examples:

To accept a handshake from another account


/* Bill is the owner of an organization, and he invites Juan's account (222222222222) to join his organization. The following example shows Juan's account accepting the handshake and thus agreeing to the invitation. */

 var params = {
  HandshakeId: "h-examplehandshakeid111"
 };
 organizations.acceptHandshake(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Handshake: {
     Action: "INVITE", 
     Arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
     ExpirationTimestamp: <Date Representation>, 
     Id: "h-examplehandshakeid111", 
     Parties: [
        {
       Id: "o-exampleorgid", 
       Type: "ORGANIZATION"
      }, 
        {
       Id: "juan@example.com", 
       Type: "EMAIL"
      }
     ], 
     RequestedTimestamp: <Date Representation>, 
     Resources: [
        {
       Resources: [
          {
         Type: "MASTER_EMAIL", 
         Value: "bill@amazon.com"
        }, 
          {
         Type: "MASTER_NAME", 
         Value: "Org Master Account"
        }, 
          {
         Type: "ORGANIZATION_FEATURE_SET", 
         Value: "ALL"
        }
       ], 
       Type: "ORGANIZATION", 
       Value: "o-exampleorgid"
      }, 
        {
       Type: "ACCOUNT", 
       Value: "222222222222"
      }
     ], 
     State: "ACCEPTED"
    }
   }
   */
 });

Calling the acceptHandshake operation

var params = {
  HandshakeId: 'STRING_VALUE' /* required */
};
organizations.acceptHandshake(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • HandshakeId — (String)

      The unique identifier (ID) of the handshake that you want to accept.

      The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Handshake — (map)

        A structure that contains details about the accepted handshake.

        • Id — (String)

          The unique identifier (ID) of a handshake. The originating account creates the ID when it initiates the handshake.

          The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

        • Arn — (String)

          The Amazon Resource Name (ARN) of a handshake.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the Amazon Web Services Service Authorization Reference.

        • Parties — (Array<map>)

          Information about the two accounts that are participating in the handshake.

          • Idrequired — (String)

            The unique identifier (ID) for the party.

            The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

          • Typerequired — (String)

            The type of party.

            Possible values include:
            • "ACCOUNT"
            • "ORGANIZATION"
            • "EMAIL"
        • State — (String)

          The current state of the handshake. Use the state to trace the flow of the handshake through the process from its creation to its acceptance. The meaning of each of the valid values is as follows:

          • REQUESTED: This handshake was sent to multiple recipients (applicable to only some handshake types) and not all recipients have responded yet. The request stays in this state until all recipients respond.

          • OPEN: This handshake was sent to multiple recipients (applicable to only some policy types) and all recipients have responded, allowing the originator to complete the handshake action.

          • CANCELED: This handshake is no longer active because it was canceled by the originating account.

          • ACCEPTED: This handshake is complete because it has been accepted by the recipient.

          • DECLINED: This handshake is no longer active because it was declined by the recipient account.

          • EXPIRED: This handshake is no longer active because the originator did not receive a response of any kind from the recipient before the expiration time (15 days).

          Possible values include:
          • "REQUESTED"
          • "OPEN"
          • "CANCELED"
          • "ACCEPTED"
          • "DECLINED"
          • "EXPIRED"
        • RequestedTimestamp — (Date)

          The date and time that the handshake request was made.

        • ExpirationTimestamp — (Date)

          The date and time that the handshake expires. If the recipient of the handshake request fails to respond before the specified date and time, the handshake becomes inactive and is no longer valid.

        • Action — (String)

          The type of handshake, indicating what action occurs when the recipient accepts the handshake. The following handshake types are supported:

          • INVITE: This type of handshake represents a request to join an organization. It is always sent from the management account to only non-member accounts.

          • ENABLE_ALL_FEATURES: This type of handshake represents a request to enable all features in an organization. It is always sent from the management account to only invited member accounts. Created accounts do not receive this because those accounts were created by the organization's management account and approval is inferred.

          • APPROVE_ALL_FEATURES: This type of handshake is sent from the Organizations service when all member accounts have approved the ENABLE_ALL_FEATURES invitation. It is sent only to the management account and signals the master that it can finalize the process to enable all features.

          Possible values include:
          • "INVITE"
          • "ENABLE_ALL_FEATURES"
          • "APPROVE_ALL_FEATURES"
          • "ADD_ORGANIZATIONS_SERVICE_LINKED_ROLE"
        • Resources — (Array<map>)

          Additional information that is needed to process the handshake.

          • Value — (String)

            The information that is passed to the other party in the handshake. The format of the value string must match the requirements of the specified type.

          • Type — (String)

            The type of information being passed, specifying how the value is to be interpreted by the other party:

            • ACCOUNT - Specifies an Amazon Web Services account ID number.

            • ORGANIZATION - Specifies an organization ID number.

            • EMAIL - Specifies the email address that is associated with the account that receives the handshake.

            • OWNER_EMAIL - Specifies the email address associated with the management account. Included as information about an organization.

            • OWNER_NAME - Specifies the name associated with the management account. Included as information about an organization.

            • NOTES - Additional text provided by the handshake initiator and intended for the recipient to read.

            Possible values include:
            • "ACCOUNT"
            • "ORGANIZATION"
            • "ORGANIZATION_FEATURE_SET"
            • "EMAIL"
            • "MASTER_EMAIL"
            • "MASTER_NAME"
            • "NOTES"
            • "PARENT_HANDSHAKE"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

attachPolicy(params = {}, callback) ⇒ AWS.Request

Attaches a policy to a root, an organizational unit (OU), or an individual account. How the policy affects accounts depends on the type of policy. Refer to the Organizations User Guide for information about each policy type:

This operation can be called only from the organization's management account or by a member account that is a delegated administrator for an Amazon Web Services service.

Service Reference:

Examples:

To attach a policy to an OU


/* The following example shows how to attach a service control policy (SCP) to an OU:
*/

 var params = {
  PolicyId: "p-examplepolicyid111", 
  TargetId: "ou-examplerootid111-exampleouid111"
 };
 organizations.attachPolicy(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
 });

To attach a policy to an account


/* The following example shows how to attach a service control policy (SCP) to an account:
*/

 var params = {
  PolicyId: "p-examplepolicyid111", 
  TargetId: "333333333333"
 };
 organizations.attachPolicy(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
 });

Calling the attachPolicy operation

var params = {
  PolicyId: 'STRING_VALUE', /* required */
  TargetId: 'STRING_VALUE' /* required */
};
organizations.attachPolicy(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • PolicyId — (String)

      The unique identifier (ID) of the policy that you want to attach to the target. You can get the ID for the policy by calling the ListPolicies operation.

      The regex pattern for a policy ID string requires "p-" followed by from 8 to 128 lowercase or uppercase letters, digits, or the underscore character (_).

    • TargetId — (String)

      The unique identifier (ID) of the root, OU, or account that you want to attach the policy to. You can get the ID by calling the ListRoots, ListOrganizationalUnitsForParent, or ListAccounts operations.

      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.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

cancelHandshake(params = {}, callback) ⇒ AWS.Request

Cancels a handshake. Canceling a handshake sets the handshake state to CANCELED.

This operation can be called only from the account that originated the handshake. The recipient of the handshake can't cancel it, but can use DeclineHandshake instead. After a handshake is canceled, the recipient can no longer respond to that handshake.

After you cancel a handshake, it continues to appear in the results of relevant APIs for only 30 days. After that, it's deleted.

Service Reference:

Examples:

To cancel a handshake sent to a member account


/* Bill previously sent an invitation to Susan's account to join his organization. He changes his mind and decides to cancel the invitation before Susan accepts it. The following example shows Bill's cancellation:
*/

 var params = {
  HandshakeId: "h-examplehandshakeid111"
 };
 organizations.cancelHandshake(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Handshake: {
     Action: "INVITE", 
     Arn: "arn:aws:organizations::111111111111:handshake/o-exampleorgid/invite/h-examplehandshakeid111", 
     ExpirationTimestamp: <Date Representation>, 
     Id: "h-examplehandshakeid111", 
     Parties: [
        {
       Id: "o-exampleorgid", 
       Type: "ORGANIZATION"
      }, 
        {
       Id: "susan@example.com", 
       Type: "EMAIL"
      }
     ], 
     RequestedTimestamp: <Date Representation>, 
     Resources: [
        {
       Resources: [
          {
         Type: "MASTER_EMAIL", 
         Value: "bill@example.com"
        }, 
          {
         Type: "MASTER_NAME", 
         Value: "Master Account"
        }, 
          {
         Type: "ORGANIZATION_FEATURE_SET", 
         Value: "CONSOLIDATED_BILLING"
        }
       ], 
       Type: "ORGANIZATION", 
       Value: "o-exampleorgid"
      }, 
        {
       Type: "ACCOUNT", 
       Value: "222222222222"
      }, 
        {
       Type: "NOTES", 
       Value: "This is a request for Susan's account to join Bob's organization."
      }
     ], 
     State: "CANCELED"
    }
   }
   */
 });

Calling the cancelHandshake operation

var params = {
  HandshakeId: 'STRING_VALUE' /* required */
};
organizations.cancelHandshake(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • HandshakeId — (String)

      The unique identifier (ID) of the handshake that you want to cancel. You can get the ID from the ListHandshakesForOrganization operation.

      The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Handshake — (map)

        A structure that contains details about the handshake that you canceled.

        • Id — (String)

          The unique identifier (ID) of a handshake. The originating account creates the ID when it initiates the handshake.

          The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

        • Arn — (String)

          The Amazon Resource Name (ARN) of a handshake.

          For more information about ARNs in Organizations, see ARN Formats Supported by Organizations in the Amazon Web Services Service Authorization Reference.

        • Parties — (Array<map>)

          Information about the two accounts that are participating in the handshake.

          • Idrequired — (String)

            The unique identifier (ID) for the party.

            The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

          • Typerequired — (String)

            The type of party.

            Possible values include:
            • "ACCOUNT"
            • "ORGANIZATION"
            • "EMAIL"
        • State — (String)

          The current state of the handshake. Use the state to trace the flow of the handshake through the process from its creation to its acceptance. The meaning of each of the valid values is as follows:

          • REQUESTED: This handshake was sent to multiple recipients (applicable to only some handshake types) and not all recipients have responded yet. The request stays in this state until all recipients respond.

          • OPEN: This handshake was sent to multiple recipients (applicable to only some policy types) and all recipients have responded, allowing the originator to complete the handshake action.

          • CANCELED: This handshake is no longer active because it was canceled by the originating account.

          • ACCEPTED: This handshake is complete because it has been accepted by the recipient.

          • DECLINED: This handshake is no longer active because it was declined by the recipient account.

          • EXPIRED: This handshake is no longer active because the originator did not receive a response of any kind from the recipient before the expiration time (15 days).

          Possible values include:
          • "REQUESTED"
          • "OPEN"
          • "CANCELED"
          • "ACCEPTED"
          • "DECLINED"
          • "EXPIRED"
        • RequestedTimestamp — (Date)

          The date and time that the handshake request was made.

        • ExpirationTimestamp — (Date)

          The date and time that the handshake expires. If the recipient of the handshake request fails to respond before the specified date and time, the handshake becomes inactive and is no longer valid.

        • Action — (String)

          The type of handshake, indicating what action occurs when the recipient accepts the handshake. The following handshake types are supported:

          • INVITE: This type of handshake represents a request to join an organization. It is always sent from the management account to only non-member accounts.

          • ENABLE_ALL_FEATURES: This type of handshake represents a request to enable all features in an organization. It is always sent from the management account to only invited member accounts. Created accounts do not receive this because those accounts were created by the organization's management account and approval is inferred.

          • APPROVE_ALL_FEATURES: This type of handshake is sent from the Organizations service when all member accounts have approved the ENABLE_ALL_FEATURES invitation. It is sent only to the management account and signals the master that it can finalize the process to enable all features.

          Possible values include:
          • "INVITE"
          • "ENABLE_ALL_FEATURES"
          • "APPROVE_ALL_FEATURES"
          • "ADD_ORGANIZATIONS_SERVICE_LINKED_ROLE"
        • Resources — (Array<map>)

          Additional information that is needed to process the handshake.

          • Value — (String)

            The information that is passed to the other party in the handshake. The format of the value string must match the requirements of the specified type.

          • Type — (String)

            The type of information being passed, specifying how the value is to be interpreted by the other party:

            • ACCOUNT - Specifies an Amazon Web Services account ID number.

            • ORGANIZATION - Specifies an organization ID number.

            • EMAIL - Specifies the email address that is associated with the account that receives the handshake.

            • OWNER_EMAIL - Specifies the email address associated with the management account. Included as information about an organization.

            • OWNER_NAME - Specifies the name associated with the management account. Included as information about an organization.

            • NOTES - Additional text provided by the handshake initiator and intended for the recipient to read.

            Possible values include:
            • "ACCOUNT"
            • "ORGANIZATION"
            • "ORGANIZATION_FEATURE_SET"
            • "EMAIL"
            • "MASTER_EMAIL"
            • "MASTER_NAME"
            • "NOTES"
            • "PARENT_HANDSHAKE"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

closeAccount(params = {}, callback) ⇒ AWS.Request

Closes an Amazon Web Services member account within an organization. You can close an account when all features are enabled . You can't close the management account with this API. This is an asynchronous request that Amazon Web Services performs in the background. Because CloseAccount operates asynchronously, it can return a successful completion message even though account closure might still be in progress. You need to wait a few minutes before the account is fully closed. To check the status of the request, do one of the following:

  • Use the AccountId that you sent in the CloseAccount request to provide as a parameter to the DescribeAccount operation.

    While the close account request is in progress, Account status will indicate PENDING_CLOSURE. When the close account request completes, the status will change to SUSPENDED.

  • Check the CloudTrail log for the CloseAccountResult event that gets published after the account closes successfully. For information on using CloudTrail with Organizations, see Logging and monitoring in Organizations in the Organizations User Guide.

Note:
  • You can close only 10% of member accounts, between 10 and 1000, within a rolling 30 day period. This quota is not bound by a calendar month, but starts when you close an account. After you reach this limit, you can close additional accounts. For more information, see Closing a member account in your organization and Quotas for Organizationsin the Organizations User Guide.
  • To reinstate a closed account, contact Amazon Web Services Support within the 90-day grace period while the account is in SUSPENDED status.
  • If the Amazon Web Services account you attempt to close is linked to an Amazon Web Services GovCloud (US) account, the CloseAccount request will close both accounts. To learn important pre-closure details, see Closing an Amazon Web Services GovCloud (US) account in the Amazon Web Services GovCloud User Guide.

Service Reference:

Examples:

Calling the closeAccount operation

var params = {
  AccountId: 'STRING_VALUE' /* required */
};
organizations.closeAccount(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • AccountId — (String)

      Retrieves the Amazon Web Services account Id for the current CloseAccount API request.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

createAccount(params = {}, callback) ⇒ AWS.Request

Creates an Amazon Web Services account that is automatically a member of the organization whose credentials made the request. This is an asynchronous request that Amazon Web Services 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 Id value of the CreateAccountStatus response element from this operation to provide as a parameter to the DescribeCreateAccountStatus operation.

  • Check the CloudTrail log for the CreateAccountResult event. For information on using CloudTrail with Organizations, see Logging and monitoring in Organizations in the 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, Organizations creates the required service-linked role named AWSServiceRoleForOrganizations. For more information, see Organizations and service-linked roles in the Organizations User Guide.

If the request includes tags, then the requester must have the organizations:TagResource permission.

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

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

For more information about creating accounts, see Creating a member account in your organization in the Organizations User Guide.

  • When you create an account in an organization using the Organizations console, API, or CLI commands, the information required for the account to operate as a standalone account, such as a payment method is not automatically collected. If you must remove an account from your organization later, you can do so only after you provide the missing information. For more information, see Considerations before removing an account from an organization in the Organizations User Guide.

  • If you get an exception that indicates that you exceeded your account limits for the organization, contact Amazon Web Services Support.

  • If you get an exception that indicates that the operation failed because your organization is still initializing, wait one hour and then try again. If the error persists, contact Amazon Web Services Support.

  • Using CreateAccount to create multiple temporary accounts isn't recommended. You can only close an account from the Billing and Cost Management console, and you must be signed in as the root user. For information on the requirements and process for closing an account, see Closing a member account in your organization in the Organizations User Guide.

Note: When you create a member account with this operation, you can choose whether to create the account with the IAM User and Role Access to Billing Information switch enabled. If you enable it, IAM users and roles that have appropriate permissions can view billing information for the account. If you disable it, only the account root user can access billing information. For information about how to disable this switch for an account, see Granting access to your billing information and tools.

Service Reference:

Examples:

To create a new account that is automatically part of the organization


/* The owner of an organization creates a member account in the organization. The following example shows that when the organization owner creates the member account, the account is preconfigured with the name "Production Account" and an owner email address of susan@example.com.  An IAM role is automatically created using the default name because the roleName parameter is not used. AWS Organizations sends Susan a "Welcome to AWS" email:

*/

 var params = {
  AccountName: "Production Account", 
  Email: "susan@example.com"
 };
 organizations.createAccount(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    CreateAccountStatus: {
     Id: "car-examplecreateaccountrequestid111", 
     State: "IN_PROGRESS"
    }
   }
   */
 });

Calling the createAccount operation

var params = {
  AccountName: 'STRING_VALUE', /* required */
  Email: 'STRING_VALUE', /* required */
  IamUserAccessToBilling: ALLOW | DENY,
  RoleName: 'STRING_VALUE',
  Tags: [
    {
      Key: 'STRING_VALUE', /* required */
      Value: 'STRING_VALUE' /* required */
    },
    /* more items */
  ]
};
organizations.createAccount(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Email — (String)

      The email address of the owner to assign to the new member account. This email address must not already be associated with another Amazon Web Services account. You must use a valid email address to complete account creation.

      The rules for a valid email address:

      • The address must be a minimum of 6 and a maximum of 64 characters long.

      • All characters must be 7-bit ASCII characters.

      • There must be one and only one @ symbol, which separates the local name from the domain name.

      • The local name can't contain any of the following characters:

        whitespace, " ' ( ) < > [ ] : ; , \ | % &

      • The local name can't begin with a dot (.)

      • The domain name can consist of only the characters [a-z],[A-Z],[0-9], hyphen (-), or dot (.)

      • The domain name can't begin or end with a hyphen (-) or dot (.)

      • The domain name must contain at least one dot

      You can't access the root user of the account or remove an account that was created with an invalid email address.

    • AccountName — (String)

      The friendly name of the member account.

    • RoleName — (String)

      The name of an IAM role that Organizations automatically preconfigures in the new member account. This role trusts the management account, allowing users in the management account to assume the role, as permitted by the management 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 the following links: