Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 1.29 KB

README.md

File metadata and controls

40 lines (32 loc) · 1.29 KB

AWS Organization Formation Client

A typescript client library for AWS Organization Formation.

Installation

> npm i aws-organization-formation-client

Usage

const orgClient = new OrgFormationClient( {
    credentials : myCrendialsProvider.resolve(), // works just like any other aws service
    stateBucketName: 'my-state-bucket-name', // default will be organization-formation-${MasterAccountId}
    stateObjectKey: 'state.json', // this is the default
    organizationObjectKey: 'organization.yml', // this is the default
})

how to enumerate account ids

const developmentOUBinding: IOrganizationBinding = { OrganizationalUnit: { Ref: 'DevelopmentOU' } };
const developmentOUAccountIds: string[] = await orgClient.enumerateAccountIds(developmentOUBinding);

const moreComplexBinding: IOrganizationBinding = { IncludeMasterAccount: true, Account: '*', ExcludeAccount: [ { Ref: 'AccountB' } ] };
const moreComplexAccountIds: string[] = await orgClient.enumerateAccountIds(moreComplexBinding);

how to retrieve metadata related to an account:

const account = await orgClient.getAccount('1223123123123');
console.log(account.logicalId);
console.log(account.accountName);
console.log(account.alias);
console.log(account.rootEmail);
console.log(account.tags);
//etc