This project provides a CDK construct creating AWS organizations.
Project description
AWS Organizations
This project provides a CDK construct creating AWS organizations.
Currently, there is no
@aws-cdk/aws-organizations
available. See this Issue on AWS CDK.
- AWS Account Management Reference Guide
- AWS Organizations User Guide
- AWS API Reference
- AWS CDK Custom Resources
See API.md
Install
TypeScript
npm install @pepperize/cdk-organizations
or
yarn add @pepperize/cdk-organizations
Python
pip install pepperize.cdk-organizations
C# / .Net
dotnet add package Pepperize.CDK.Organizations
Example
See example.ts
import { App, Stack } from "@aws-cdk/core";
import {
Account,
DelegatedAdministrator,
EnableAwsServiceAccess,
FeatureSet,
IamUserAccessToBilling,
Organization,
OrganizationalUnit,
Policy,
PolicyAttachment,
PolicyType,
} from "@pepperize/cdk-organizations";
const app = new App();
const stack = new Stack(app);
// Create an organization
const organization = new Organization(stack, "Organization", {
featureSet: FeatureSet.ALL,
});
// Enable AWS Service Access (requires FeatureSet: ALL)
new EnableAwsServiceAccess(stack, "EnableAwsServiceAccess", {
servicePrincipal: "service-abbreviation.amazonaws.com",
});
// Create an account
const account = new Account(stack, "SharedAccount", {
accountName: "SharedAccount",
email: "info+shared-account@pepperize.com",
roleName: "OrganizationAccountAccessRole",
iamUserAccessToBilling: IamUserAccessToBilling.ALLOW,
parent: organization.root,
});
// Enable a delegated admin account
new DelegatedAdministrator(stack, "DelegatedAdministrator", {
account: account,
servicePrincipal: "service-abbreviation.amazonaws.com",
});
// Create an OU in the current organizations root
const projects = new OrganizationalUnit(stack, "ProjectsOU", {
organizationalUnitName: "Projects",
parent: organization.root,
});
new Account(stack, "Project1Account", {
accountName: "SharedAccount",
email: "info+project1@pepperize.com",
parent: projects,
});
// Create a nested OU and attach two accounts
const project2 = new OrganizationalUnit(stack, "Project2OU", {
organizationalUnitName: "Project2",
parent: projects,
});
new Account(stack, "Project2DevAccount", {
accountName: "Project 2 Dev",
email: "info+project2-dev@pepperize.com",
parent: project2,
});
new Account(stack, "Project2ProdAccount", {
accountName: "Project 2 Prod",
email: "info+project2-prod@pepperize.com",
parent: project2,
});
// Attach a policy to an attachment target
const policy = new Policy(stack, "Policy", {
content: '{\\"Version\\":\\"2012-10-17\\",\\"Statement\\":{\\"Effect\\":\\"Allow\\",\\"Action\\":\\"s3:*\\"}}',
description: "Enables admins of attached accounts to delegate all S3 permissions",
policyName: "AllowAllS3Actions",
policyType: PolicyType.SERVICE_CONTROL_POLICY,
});
new PolicyAttachment(stack, "PolicyAttachment", {
target: organization.root,
policy: policy,
});
Alternatives
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pepperize.cdk-organizations-0.0.19.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2a4577b2b1e3aafafd70cdb6ed47a5be8fadf1e9ce039607e1e0d3168bfdafb |
|
MD5 | e786943c3cea7ccc9a99fa913fa72010 |
|
BLAKE2b-256 | b764d35e21cccc97cf49f7a05af8ed0f70513bd6f16689620a9cb10146e4d57b |
Close
Hashes for pepperize.cdk_organizations-0.0.19-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d3ce3b4b1fd390e0a5eb9d9ee7bc5b301b73e3297402d389cccd76bea20558f |
|
MD5 | 7a216b1da0a8b7497f77ead2bf1e6a2c |
|
BLAKE2b-256 | ac3444e98c0823b05627d4f065598fe3d43c02e7d481fa6d1d556a6241d3e383 |