AWS Organization
Getting started
Installation
Install the library in your project:
npm install @jttc/aws-organization
yarn add @jttc/aws-organization
Usage
New Organization
To create a new AWS Organization, use the Organization Construct provided. By default, it creates an organization with all FeatureSet.
| import { Construct } from 'constructs';
import { Organization } from '@jttc/aws-organizations';
export class OrganizationStack extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
new Organization(this, 'Organization');
}
}
|
The construct provides the option to create the organization in Consolidated Bill feature set.
| import { Construct } from 'constructs';
import { Organization, OrganizationFeatureSet } from '@jttc/aws-organizations';
export class OrganizationStack extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
new Organization(this, 'Organization', {
featureSet: OrganizationFeatureSet.CONSOLIDATED_BILLING,
});
}
}
|
Existing organization
The construct provides a method to import a organization from existing one
| import { Construct } from 'constructs';
import { Organization } from '@jttc/aws-organizations';
export class OrganizationStack extends Construct {
constructor(scope: Construct, id: string) {
super(scope, id);
const organization = Organization.fromOrganizationAttributes(
this,
'Organization',
{
organizationId: 'o-agnj84t7qk',
organizationRootId: 'r-rkw8',
managementAccountId: '123456789012',
}
);
}
}
|