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/organizations
available. See this AWS CDK Issue.
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,
FeatureSet,
IamUserAccessToBilling,
Organization,
OrganizationalUnit,
Policy,
PolicyAttachment,
PolicyType,
} from "@pepperize/cdk-organizations";
const app = new App();
const stack = new Stack(app);
// Create the organization
const organization = new Organization(stack, "Organization", {
featureSet: FeatureSet.ALL,
});
// Create an Account in the current organization
new Account(stack, "SharedAccount", {
accountName: "SharedAccount",
email: "info+shared-account@pepperize.com",
roleName: "OrganizationAccountAccessRole",
iamUserAccessToBilling: IamUserAccessToBilling.ALLOW,
parent: organization.root,
});
// 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,
});
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.17.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffe564f4bca3e6f0ea4e43b9e774f26bb781dc997413a474f44d8a944dfa3997 |
|
MD5 | 30167f51791b342948f77ee824532d8b |
|
BLAKE2b-256 | 930d3af11a62720ec8ffbcc803dba45ee873f727c585e055d10b5c8acb5dd112 |
Close
Hashes for pepperize.cdk_organizations-0.0.17-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bae17f1fbbbb0a6f2a9cb92268845002adb30d6841b82a8f5e04f15ddc4f6e0b |
|
MD5 | bc0e4dfc9d68ca6834125ebd599879db |
|
BLAKE2b-256 | 33a0e71fefecd82d323eab30cba1dacb03dc0ccdd53af70c442bc51932d5bb4f |