@aws-cdk_aws-amplify-alpha.Domain

class Domain (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Amplify.Alpha.Domain
Gogithub.com/aws/aws-cdk-go/awscdkamplifyalpha/v2#Domain
Javasoftware.amazon.awscdk.services.amplify.alpha.Domain
Pythonaws_cdk.aws_amplify_alpha.Domain
TypeScript (source)@aws-cdk/aws-amplify-alpha ยป Domain

Implements IConstruct, IDependable, IResource

An Amplify Console domain.

Example

declare const amplifyApp: amplify.App;
declare const main: amplify.Branch;
declare const dev: amplify.Branch;

const domain = amplifyApp.addDomain('example.com', {
  enableAutoSubdomain: true, // in case subdomains should be auto registered for branches
  autoSubdomainCreationPatterns: ['*', 'pr*'], // regex for branches that should auto register subdomains
});
domain.mapRoot(main); // map main branch to domain root
domain.mapSubDomain(main, 'www');
domain.mapSubDomain(dev); // sub domain prefix defaults to branch name

Initializer

new Domain(scope: Construct, id: string, props: DomainProps)

Parameters

  • scope Construct
  • id string
  • props DomainProps

Construct Props

NameTypeDescription
app๐Ÿ”นIAppThe application to which the domain must be connected.
autoSubDomainIamRole?๐Ÿ”นIRoleThe IAM role with access to Route53 when using enableAutoSubdomain.
autoSubdomainCreationPatterns?๐Ÿ”นstring[]Branches which should automatically create subdomains.
domainName?๐Ÿ”นstringThe name of the domain.
enableAutoSubdomain?๐Ÿ”นbooleanAutomatically create subdomains for connected branches.
subDomains?๐Ÿ”นSubDomain[]Subdomains.

app๐Ÿ”น

Type: IApp

The application to which the domain must be connected.


autoSubDomainIamRole?๐Ÿ”น

Type: IRole (optional, default: the IAM role from App.grantPrincipal)

The IAM role with access to Route53 when using enableAutoSubdomain.


autoSubdomainCreationPatterns?๐Ÿ”น

Type: string[] (optional, default: all repository branches ['', 'pr'])

Branches which should automatically create subdomains.


domainName?๐Ÿ”น

Type: string (optional, default: the construct's id)

The name of the domain.


enableAutoSubdomain?๐Ÿ”น

Type: boolean (optional, default: false)

Automatically create subdomains for connected branches.


subDomains?๐Ÿ”น

Type: SubDomain[] (optional, default: use addSubDomain() to add subdomains)

Subdomains.

Properties

NameTypeDescription
arn๐Ÿ”นstringThe ARN of the domain.
certificateRecord๐Ÿ”นstringThe DNS Record for certificate verification.
domainAutoSubDomainCreationPatterns๐Ÿ”นstring[]Branch patterns for the automatically created subdomain.
domainAutoSubDomainIamRole๐Ÿ”นstringThe IAM service role for the subdomain.
domainEnableAutoSubDomain๐Ÿ”นIResolvableSpecifies whether the automated creation of subdomains for branches is enabled.
domainName๐Ÿ”นstringThe name of the domain.
domainStatus๐Ÿ”นstringThe status of the domain association.
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
node๐Ÿ”นNodeThe tree node.
stack๐Ÿ”นStackThe stack in which this resource is defined.
statusReason๐Ÿ”นstringThe reason for the current status of the domain.

arn๐Ÿ”น

Type: string

The ARN of the domain.


certificateRecord๐Ÿ”น

Type: string

The DNS Record for certificate verification.


domainAutoSubDomainCreationPatterns๐Ÿ”น

Type: string[]

Branch patterns for the automatically created subdomain.


domainAutoSubDomainIamRole๐Ÿ”น

Type: string

The IAM service role for the subdomain.


domainEnableAutoSubDomain๐Ÿ”น

Type: IResolvable

Specifies whether the automated creation of subdomains for branches is enabled.


domainName๐Ÿ”น

Type: string

The name of the domain.


domainStatus๐Ÿ”น

Type: string

The status of the domain association.


env๐Ÿ”น

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node๐Ÿ”น

Type: Node

The tree node.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.


statusReason๐Ÿ”น

Type: string

The reason for the current status of the domain.

Methods

NameDescription
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
mapRoot(branch)๐Ÿ”นMaps a branch to the domain root.
mapSubDomain(branch, prefix?)๐Ÿ”นMaps a branch to a sub domain.
toString()๐Ÿ”นReturns a string representation of this construct.

applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).


mapRoot(branch)๐Ÿ”น

public mapRoot(branch: IBranch): Domain

Parameters

  • branch IBranch

Returns

  • Domain

Maps a branch to the domain root.


mapSubDomain(branch, prefix?)๐Ÿ”น

public mapSubDomain(branch: IBranch, prefix?: string): Domain

Parameters

  • branch IBranch โ€” The branch.
  • prefix string โ€” The prefix.

Returns

  • Domain

Maps a branch to a sub domain.


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.