aws-activate v1.0.3
AWS Activate
Expose a set of CDK Stacks & Constructs to help you get started properly on AWS.
Usage
Install
npm install aws-activateCheck the microservices/cdk/aws-activate
API Reference
Classes
| Name | Description |
|---|---|
| Account | An AWS Account. |
| OrganizationsStack | A Stack creating the Software Development Life Cycle (SDLC) Organization. |
| 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. |
| RootDns | A class creating the main hosted zone and a role assumable by stages account to be able to set sub domain delegation. |
| SecureRootUser | No description |
| ValidateEmail | Email Validation. |
Structs
| Name | Description |
|---|---|
| AccountSpec | AWS Account input details. |
| OrganizationsStackProps | Properties for AWS SDLC Organizations Stack. |
| OUSpec | Organizational Unit Input details. |
| RootDnsProps | Properties for RootDns. |
| ValidateEmailProps | Properties of ValidateEmail. |
Interfaces
| Name | Description |
|---|---|
| IAccountProps | Properties of an AWS account. |
| ICrossAccountDNSDelegatorProps | Properties to create delegated subzone of a zone hosted in a different account. |
Enums
| Name | Description |
|---|---|
| AccountType | No description |
class Account
An AWS Account.
Implements: IConstruct, IConstruct, IConstruct, IDependable Extends: Construct
Initializer
new Account(scope: Construct, id: string, accountProps: IAccountProps)- scope (Construct) No description
- id (string) No description
- accountProps (IAccountProps) No description
Properties
| Name | Type | Description |
|---|---|---|
| accountId | string | |
| accountName | string | Constructor. |
| accountStageName? | string | Optional |
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:
analyticsReportingsetting of containingApp, 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
Stageif 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:
DefaultStackSynthesizerif the@aws-cdk/core:newStyleStackSynthesisfeature flag is set,LegacyStackSynthesizerotherwise. - 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
- analyticsReporting (boolean) Include runtime versioning information in this Stack. Default:
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)- scope (Construct) No description
- id (string) No description
- props (ICrossAccountDNSDelegatorProps) No description
Properties
| Name | Type | Description |
|---|---|---|
| hostedZone | HostedZone |
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
| Name | Type | Description |
|---|---|---|
| rootHostedZone | IHostedZone |
Methods
createDNSAutoUpdateRole(account, stageSubZone)
createDNSAutoUpdateRole(account: Account, stageSubZone: HostedZone): Role- account (Account) No description
- stageSubZone (HostedZone) No description
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.
| Name | Type | Description |
|---|---|---|
| name | string | The name of the AWS account. |
| email? | string | The email associated to the AWS account.Optional |
| hostedServices? | Array | List of your services that will be hosted in this account.Optional |
| stageName? | string | The (optional) Stage name to be used in CI/CD pipeline.Optional |
| stageOrder? | number | The (optional) Stage deployment order.Optional |
| type? | AccountType | The account type.Optional |
struct OrganizationsStackProps 🔹
Properties for AWS SDLC Organizations Stack.
| Name | Type | Description |
|---|---|---|
| email🔹 | string | Email address of the Root account. |
| nestedOU🔹 | Array<OUSpec> | Specification of the sub Organizational Unit. |
| 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. |
| forceEmailVerification?🔹 | boolean | Enable Email Verification Process.Optional |
| rootHostedZoneDNSName?🔹 | string | The main DNS domain name to manage.Optional |
| 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 |
| thirdPartyProviderDNSUsed?🔹 | boolean | A 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
| Name | Type | Description |
|---|---|---|
| string | The email to use to create the AWS account. | |
| name | string | The name of the AWS Account. |
| hostedServices? | Array | List of your services that will be hosted in this account.Optional |
| id? | string | The AWS account Id.Optional |
| parentOrganizationalUnitId? | string | The potential Organizational Unit Id the account should be placed in.Optional |
| parentOrganizationalUnitName? | string | The potential Organizational Unit Name the account should be placed in.Optional |
| stageName? | string | The (optional) Stage name to be used in CI/CD pipeline.Optional |
| stageOrder? | number | The (optional) Stage deployment order.Optional |
| type? | AccountType | The account type.Optional |
interface ICrossAccountDNSDelegatorProps
Properties to create delegated subzone of a zone hosted in a different account.
Properties
| Name | Type | Description |
|---|---|---|
| zoneName | string | The sub zone name to be created. |
| targetAccount? | string | The Account hosting the parent zone Optional since can be resolved if the system has been setup with aws-activate.Optional |
| targetHostedZoneId? | string | The 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? | string | The 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.
| Name | Type | Description |
|---|---|---|
| accounts | Array<AccountSpec> | Accounts' specification inside in this Organizational Unit. |
| name | string | Name of the Organizational Unit. |
| nestedOU? | Array<OUSpec> | Specification of sub Organizational Unit.Optional |
struct RootDnsProps
Properties for RootDns.
| Name | Type | 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 |
struct ValidateEmailProps
Properties of ValidateEmail.
| Name | Type | Description |
|---|---|---|
| string | Email address of the Root account. | |
| timeout? | Duration | Optional |
enum AccountType
| Name | Description |
|---|---|
| CICD | |
| DNS | |
| STAGE | |
| PLAYGROUND |