1. Packages
  2. AWS
  3. API Docs
  4. organizations
  5. getOrganizationalUnitDescendantAccounts
AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi

aws.organizations.getOrganizationalUnitDescendantAccounts

Get Started
aws logo
AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi

    Get all direct child accounts under a parent organizational unit. This provides all children.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const org = aws.organizations.getOrganization({});
    const accounts = org.then(org => aws.organizations.getOrganizationalUnitDescendantAccounts({
        parentId: org.roots?.[0]?.id,
    }));
    
    import pulumi
    import pulumi_aws as aws
    
    org = aws.organizations.get_organization()
    accounts = aws.organizations.get_organizational_unit_descendant_accounts(parent_id=org.roots[0].id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/organizations"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = organizations.GetOrganizationalUnitDescendantAccounts(ctx, &organizations.GetOrganizationalUnitDescendantAccountsArgs{
    			ParentId: org.Roots[0].Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var org = Aws.Organizations.GetOrganization.Invoke();
    
        var accounts = Aws.Organizations.GetOrganizationalUnitDescendantAccounts.Invoke(new()
        {
            ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.organizations.OrganizationsFunctions;
    import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitDescendantAccountsArgs;
    import java.util.List;
    import java.util.ArrayList;
    import java.util.Map;
    import java.io.File;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class App {
        public static void main(String[] args) {
            Pulumi.run(App::stack);
        }
    
        public static void stack(Context ctx) {
            final var org = OrganizationsFunctions.getOrganization(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);
    
            final var accounts = OrganizationsFunctions.getOrganizationalUnitDescendantAccounts(GetOrganizationalUnitDescendantAccountsArgs.builder()
                .parentId(org.roots()[0].id())
                .build());
    
        }
    }
    
    variables:
      org:
        fn::invoke:
          function: aws:organizations:getOrganization
          arguments: {}
      accounts:
        fn::invoke:
          function: aws:organizations:getOrganizationalUnitDescendantAccounts
          arguments:
            parentId: ${org.roots[0].id}
    

    Using getOrganizationalUnitDescendantAccounts

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getOrganizationalUnitDescendantAccounts(args: GetOrganizationalUnitDescendantAccountsArgs, opts?: InvokeOptions): Promise<GetOrganizationalUnitDescendantAccountsResult>
    function getOrganizationalUnitDescendantAccountsOutput(args: GetOrganizationalUnitDescendantAccountsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationalUnitDescendantAccountsResult>
    def get_organizational_unit_descendant_accounts(parent_id: Optional[str] = None,
                                                    opts: Optional[InvokeOptions] = None) -> GetOrganizationalUnitDescendantAccountsResult
    def get_organizational_unit_descendant_accounts_output(parent_id: Optional[pulumi.Input[str]] = None,
                                                    opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationalUnitDescendantAccountsResult]
    func GetOrganizationalUnitDescendantAccounts(ctx *Context, args *GetOrganizationalUnitDescendantAccountsArgs, opts ...InvokeOption) (*GetOrganizationalUnitDescendantAccountsResult, error)
    func GetOrganizationalUnitDescendantAccountsOutput(ctx *Context, args *GetOrganizationalUnitDescendantAccountsOutputArgs, opts ...InvokeOption) GetOrganizationalUnitDescendantAccountsResultOutput

    > Note: This function is named GetOrganizationalUnitDescendantAccounts in the Go SDK.

    public static class GetOrganizationalUnitDescendantAccounts 
    {
        public static Task<GetOrganizationalUnitDescendantAccountsResult> InvokeAsync(GetOrganizationalUnitDescendantAccountsArgs args, InvokeOptions? opts = null)
        public static Output<GetOrganizationalUnitDescendantAccountsResult> Invoke(GetOrganizationalUnitDescendantAccountsInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetOrganizationalUnitDescendantAccountsResult> getOrganizationalUnitDescendantAccounts(GetOrganizationalUnitDescendantAccountsArgs args, InvokeOptions options)
    public static Output<GetOrganizationalUnitDescendantAccountsResult> getOrganizationalUnitDescendantAccounts(GetOrganizationalUnitDescendantAccountsArgs args, InvokeOptions options)
    
    fn::invoke:
      function: aws:organizations/getOrganizationalUnitDescendantAccounts:getOrganizationalUnitDescendantAccounts
      arguments:
        # arguments dictionary

    The following arguments are supported:

    ParentId string
    The parent ID of the accounts.
    ParentId string
    The parent ID of the accounts.
    parentId String
    The parent ID of the accounts.
    parentId string
    The parent ID of the accounts.
    parent_id str
    The parent ID of the accounts.
    parentId String
    The parent ID of the accounts.

    getOrganizationalUnitDescendantAccounts Result

    The following output properties are available:

    Accounts List<GetOrganizationalUnitDescendantAccountsAccount>
    List of child accounts, which have the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    ParentId string
    Accounts []GetOrganizationalUnitDescendantAccountsAccount
    List of child accounts, which have the following attributes:
    Id string
    The provider-assigned unique ID for this managed resource.
    ParentId string
    accounts List<GetOrganizationalUnitDescendantAccountsAccount>
    List of child accounts, which have the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    parentId String
    accounts GetOrganizationalUnitDescendantAccountsAccount[]
    List of child accounts, which have the following attributes:
    id string
    The provider-assigned unique ID for this managed resource.
    parentId string
    accounts Sequence[GetOrganizationalUnitDescendantAccountsAccount]
    List of child accounts, which have the following attributes:
    id str
    The provider-assigned unique ID for this managed resource.
    parent_id str
    accounts List<Property Map>
    List of child accounts, which have the following attributes:
    id String
    The provider-assigned unique ID for this managed resource.
    parentId String

    Supporting Types

    GetOrganizationalUnitDescendantAccountsAccount

    Arn string
    The Amazon Resource Name (ARN) of the account.
    Email string
    The email address associated with the AWS account.
    Id string
    Parent identifier of the organizational units.
    JoinedMethod string
    Method by which the account joined the organization.
    JoinedTimestamp string
    Date the account became a part of the organization.
    Name string
    Friendly name of the account.
    State string
    State of the account in the organization.
    Status string
    (Deprecated use state instead) Status of the account in the organization.

    Deprecated: status is deprecated. Use state instead.

    Arn string
    The Amazon Resource Name (ARN) of the account.
    Email string
    The email address associated with the AWS account.
    Id string
    Parent identifier of the organizational units.
    JoinedMethod string
    Method by which the account joined the organization.
    JoinedTimestamp string
    Date the account became a part of the organization.
    Name string
    Friendly name of the account.
    State string
    State of the account in the organization.
    Status string
    (Deprecated use state instead) Status of the account in the organization.

    Deprecated: status is deprecated. Use state instead.

    arn String
    The Amazon Resource Name (ARN) of the account.
    email String
    The email address associated with the AWS account.
    id String
    Parent identifier of the organizational units.
    joinedMethod String
    Method by which the account joined the organization.
    joinedTimestamp String
    Date the account became a part of the organization.
    name String
    Friendly name of the account.
    state String
    State of the account in the organization.
    status String
    (Deprecated use state instead) Status of the account in the organization.

    Deprecated: status is deprecated. Use state instead.

    arn string
    The Amazon Resource Name (ARN) of the account.
    email string
    The email address associated with the AWS account.
    id string
    Parent identifier of the organizational units.
    joinedMethod string
    Method by which the account joined the organization.
    joinedTimestamp string
    Date the account became a part of the organization.
    name string
    Friendly name of the account.
    state string
    State of the account in the organization.
    status string
    (Deprecated use state instead) Status of the account in the organization.

    Deprecated: status is deprecated. Use state instead.

    arn str
    The Amazon Resource Name (ARN) of the account.
    email str
    The email address associated with the AWS account.
    id str
    Parent identifier of the organizational units.
    joined_method str
    Method by which the account joined the organization.
    joined_timestamp str
    Date the account became a part of the organization.
    name str
    Friendly name of the account.
    state str
    State of the account in the organization.
    status str
    (Deprecated use state instead) Status of the account in the organization.

    Deprecated: status is deprecated. Use state instead.

    arn String
    The Amazon Resource Name (ARN) of the account.
    email String
    The email address associated with the AWS account.
    id String
    Parent identifier of the organizational units.
    joinedMethod String
    Method by which the account joined the organization.
    joinedTimestamp String
    Date the account became a part of the organization.
    name String
    Friendly name of the account.
    state String
    State of the account in the organization.
    status String
    (Deprecated use state instead) Status of the account in the organization.

    Deprecated: status is deprecated. Use state instead.

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v7.10.0 published on Friday, Oct 24, 2025 by Pulumi
      Meet Neo: Your AI Platform Teammate