class Domain (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Amplify.Alpha.Domain |
![]() | github.com/aws/aws-cdk-go/awscdkamplifyalpha/v2#Domain |
![]() | software.amazon.awscdk.services.amplify.alpha.Domain |
![]() | aws_cdk.aws_amplify_alpha.Domain |
![]() | @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
Domain
Props
Construct Props
Name | Type | Description |
---|---|---|
app | IApp | The application to which the domain must be connected. |
auto | IRole | The IAM role with access to Route53 when using enableAutoSubdomain. |
auto | string[] | Branches which should automatically create subdomains. |
custom | ICertificate | The type of SSL/TLS certificate to use for your custom domain. |
domain | string | The name of the domain. |
enable | boolean | Automatically create subdomains for connected branches. |
sub | Sub [] | 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.
customCertificate?
Type:
ICertificate
(optional, default: Amplify uses the default certificate that it provisions and manages for you)
The type of SSL/TLS certificate to use for your custom domain.
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:
Sub
[]
(optional, default: use addSubDomain()
to add subdomains)
Subdomains.
Properties
Name | Type | Description |
---|---|---|
arn | string | The ARN of the domain. |
certificate | string | The DNS Record for certificate verification. |
domain | string[] | Branch patterns for the automatically created subdomain. |
domain | string | The IAM service role for the subdomain. |
domain | IResolvable | Specifies whether the automated creation of subdomains for branches is enabled. |
domain | string | The name of the domain. |
domain | string | The status of the domain association. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
stack | Stack | The stack in which this resource is defined. |
status | string | The 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:
Resource
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
Name | Description |
---|---|
apply | Apply the given removal policy to this resource. |
map | Maps a branch to the domain root. |
map | Maps a branch to a sub domain. |
to | Returns a string representation of this construct. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
Removal
Policy
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
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
Maps a branch to a sub domain.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.