1.0.3 • Published 3 years ago

aws-activate v1.0.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
3 years ago

AWS Activate

Expose a set of CDK Stacks & Constructs to help you get started properly on AWS.

Usage

  1. Install

    npm install aws-activate
  2. Check the microservices/cdk/aws-activate

API Reference

Classes

NameDescription
AccountAn AWS Account.
OrganizationsStackA Stack creating the Software Development Life Cycle (SDLC) Organization.
CrossAccountDNSDelegatorTODO: propose this to fix https://github.com/aws/aws-cdk/issues/8776 High-level construct that creates: 1. A public hosted zone in the current account 2. A record name in the hosted zone id of target account.
RootDnsA class creating the main hosted zone and a role assumable by stages account to be able to set sub domain delegation.
SecureRootUserNo description
ValidateEmailEmail Validation.

Structs

NameDescription
AccountSpecAWS Account input details.
OrganizationsStackPropsProperties for AWS SDLC Organizations Stack.
OUSpecOrganizational Unit Input details.
RootDnsPropsProperties for RootDns.
ValidateEmailPropsProperties of ValidateEmail.

Interfaces

NameDescription
IAccountPropsProperties of an AWS account.
ICrossAccountDNSDelegatorPropsProperties to create delegated subzone of a zone hosted in a different account.

Enums

NameDescription
AccountTypeNo description

class Account

An AWS Account.

Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct

Initializer

new Account(scope: Construct, id: string, accountProps: IAccountProps)

Properties

NameTypeDescription
accountIdstring
accountNamestringConstructor.
accountStageName?stringOptional

Methods

registerAsDelegatedAdministrator(accountId, servicePrincipal)

registerAsDelegatedAdministrator(accountId: string, servicePrincipal: string): void
  • accountId (string) No description
  • servicePrincipal (string) No description

class OrganizationsStack

A Stack creating the Software Development Life Cycle (SDLC) Organization.

Implements: IConstruct, IConstruct, IConstruct, IDependable, ITaggable Extends: Stack

Initializer

new OrganizationsStack(scope: Construct, id: string, props: OrganizationsStackProps)
  • scope (Construct) No description
  • id (string) No description
  • props (OrganizationsStackProps) No description
    • analyticsReporting (boolean) Include runtime versioning information in this Stack. Default: analyticsReporting setting of containing App, or value of 'aws:cdk:version-reporting' context key
    • description (string) A description of the stack. Default: No description.
    • env (Environment) The AWS environment (account/region) where this stack will be deployed. Default: The environment of the containing Stage if available, otherwise create the stack will be environment-agnostic.
    • stackName (string) Name to deploy the stack with. Default: Derived from construct path.
    • synthesizer (IStackSynthesizer) Synthesis method to use while deploying this stack. Default: DefaultStackSynthesizer if the @aws-cdk/core:newStyleStackSynthesis feature flag is set, LegacyStackSynthesizer otherwise.
    • tags (Map<string, string>) Stack tags that will be applied to all the taggable resources and the stack itself. Default: {}
    • terminationProtection (boolean) Whether to enable termination protection for this stack. Default: false
    • email (string) Email address of the Root account.
    • nestedOU (Array<OUSpec>) Specification of the sub Organizational Unit.
    • forceEmailVerification (boolean) Enable Email Verification Process. Optional
    • rootHostedZoneDNSName (string) The main DNS domain name to manage. Optional
    • thirdPartyProviderDNSUsed (boolean) A boolean used to decide if domain should be requested through this delpoyment or if already registered through a third party. Optional

class CrossAccountDNSDelegator

TODO: propose this to fix https://github.com/aws/aws-cdk/issues/8776 High-level construct that creates: 1. A public hosted zone in the current account 2. A record name in the hosted zone id of target account.

Usage: Create a role with the following permission: { "Sid": "VisualEditor0", "Effect": "Allow", "Action": "route53:GetHostedZone", "route53:ChangeResourceRecordSets" , "Resource": "arn:aws:route53:::hostedzone/ZXXXXXXXXX" }

Then use the construct like this:

const crossAccountDNSDelegatorProps: ICrossAccountDNSDelegatorProps = { targetAccount: '1234567890', targetRoleToAssume: 'DelegateRecordUpdateRoleInThatAccount', targetHostedZoneId: 'ZXXXXXXXXX', zoneName: 'subdomain.mydomain.com', };

new CrossAccountDNSDelegator(this, 'CrossAccountDNSDelegatorStack', crossAccountDNSDelegatorProps);

Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct

Initializer

new CrossAccountDNSDelegator(scope: Construct, id: string, props: ICrossAccountDNSDelegatorProps)

Properties

NameTypeDescription
hostedZoneHostedZone

class RootDns

A class creating the main hosted zone and a role assumable by stages account to be able to set sub domain delegation.

Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct

Initializer

new RootDns(scope: Construct, id: string, props: RootDnsProps)
  • scope (Construct) No description
  • id (string) No description
  • props (RootDnsProps) No description
    • rootHostedZoneDNSName (string) The top level domain name.
    • stagesAccounts (Array<Account>) The stages Accounts taht will need their subzone delegation.
    • thirdPartyProviderDNSUsed (boolean) A boolean indicating if Domain name has already been registered to a third party or if you want this contruct to create it (the latter is not yet supported). Optional

Properties

NameTypeDescription
rootHostedZoneIHostedZone

Methods

createDNSAutoUpdateRole(account, stageSubZone)

createDNSAutoUpdateRole(account: Account, stageSubZone: HostedZone): Role

Returns:

createRootHostedZone(props)

createRootHostedZone(props: RootDnsProps): HostedZone
  • props (RootDnsProps) No description
    • rootHostedZoneDNSName (string) The top level domain name.
    • stagesAccounts (Array<Account>) The stages Accounts taht will need their subzone delegation.
    • thirdPartyProviderDNSUsed (boolean) A boolean indicating if Domain name has already been registered to a third party or if you want this contruct to create it (the latter is not yet supported). Optional

Returns:

createStageSubZone(account, rootHostedZoneDNSName)

createStageSubZone(account: Account, rootHostedZoneDNSName: string): HostedZone
  • account (Account) No description
  • rootHostedZoneDNSName (string) No description

Returns:

class SecureRootUser

Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct

Initializer

new SecureRootUser(scope: Construct, id: string, notificationEmail: string)
  • scope (Construct) No description
  • id (string) No description
  • notificationEmail (string) No description

class ValidateEmail

Email Validation.

Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct

Initializer

Constructor.

new ValidateEmail(scope: Construct, id: string, props: ValidateEmailProps)
  • scope (Construct) The parent Construct instantiating this construct.
  • id (string) This instance name.
  • props (ValidateEmailProps) No description
    • email (string) Email address of the Root account.
    • timeout (Duration) No description Optional

struct AccountSpec

AWS Account input details.

NameTypeDescription
namestringThe name of the AWS account.
email?stringThe email associated to the AWS account.Optional
hostedServices?ArrayList of your services that will be hosted in this account.Optional
stageName?stringThe (optional) Stage name to be used in CI/CD pipeline.Optional
stageOrder?numberThe (optional) Stage deployment order.Optional
type?AccountTypeThe account type.Optional

struct OrganizationsStackProps 🔹

Properties for AWS SDLC Organizations Stack.

NameTypeDescription
email🔹stringEmail address of the Root account.
nestedOU🔹Array<OUSpec>Specification of the sub Organizational Unit.
analyticsReporting?🔹booleanInclude runtime versioning information in this Stack.Default: analyticsReporting setting of containing App, or value of 'aws:cdk:version-reporting' context key
description?🔹stringA description of the stack.Default: No description.
env?🔹EnvironmentThe AWS environment (account/region) where this stack will be deployed.Default: The environment of the containing Stage if available, otherwise create the stack will be environment-agnostic.
forceEmailVerification?🔹booleanEnable Email Verification Process.Optional
rootHostedZoneDNSName?🔹stringThe main DNS domain name to manage.Optional
stackName?🔹stringName to deploy the stack with.Default: Derived from construct path.
synthesizer?🔹IStackSynthesizerSynthesis method to use while deploying this stack.Default: DefaultStackSynthesizer if the @aws-cdk/core:newStyleStackSynthesis feature flag is set, LegacyStackSynthesizer otherwise.
tags?🔹Map<string, string>Stack tags that will be applied to all the taggable resources and the stack itself.Default: {}
terminationProtection?🔹booleanWhether to enable termination protection for this stack.Default: false
thirdPartyProviderDNSUsed?🔹booleanA boolean used to decide if domain should be requested through this delpoyment or if already registered through a third party.Optional

interface IAccountProps

Properties of an AWS account.

Properties

NameTypeDescription
emailstringThe email to use to create the AWS account.
namestringThe name of the AWS Account.
hostedServices?ArrayList of your services that will be hosted in this account.Optional
id?stringThe AWS account Id.Optional
parentOrganizationalUnitId?stringThe potential Organizational Unit Id the account should be placed in.Optional
parentOrganizationalUnitName?stringThe potential Organizational Unit Name the account should be placed in.Optional
stageName?stringThe (optional) Stage name to be used in CI/CD pipeline.Optional
stageOrder?numberThe (optional) Stage deployment order.Optional
type?AccountTypeThe account type.Optional

interface ICrossAccountDNSDelegatorProps

Properties to create delegated subzone of a zone hosted in a different account.

Properties

NameTypeDescription
zoneNamestringThe sub zone name to be created.
targetAccount?stringThe Account hosting the parent zone Optional since can be resolved if the system has been setup with aws-activate.Optional
targetHostedZoneId?stringThe parent zone Id to add the sub zone delegation NS record to Optional since can be resolved if the system has been setup with aws-activate.Optional
targetRoleToAssume?stringThe role to Assume in the parent zone's account which has permissions to update the parent zone Optional since can be resolved if the system has been setup with aws-activate.Optional

struct OUSpec

Organizational Unit Input details.

NameTypeDescription
accountsArray<AccountSpec>Accounts' specification inside in this Organizational Unit.
namestringName of the Organizational Unit.
nestedOU?Array<OUSpec>Specification of sub Organizational Unit.Optional

struct RootDnsProps

Properties for RootDns.

NameTypeDescription
rootHostedZoneDNSNamestringThe top level domain name.
stagesAccountsArray<Account>The stages Accounts taht will need their subzone delegation.
thirdPartyProviderDNSUsed?booleanA boolean indicating if Domain name has already been registered to a third party or if you want this contruct to create it (the latter is not yet supported).Optional

struct ValidateEmailProps

Properties of ValidateEmail.

NameTypeDescription
emailstringEmail address of the Root account.
timeout?DurationOptional

enum AccountType

NameDescription
CICD
DNS
STAGE
PLAYGROUND