Domain

class aws_cdk.aws_amplify.Domain(scope, id, *, app, auto_sub_domain_iam_role=None, auto_subdomain_creation_patterns=None, domain_name=None, enable_auto_subdomain=None, sub_domains=None)

Bases: Resource

(experimental) An Amplify Console domain.

Stability:

experimental

ExampleMetadata:

infused

Example:

# amplify_app: amplify.App
# master: amplify.Branch
# dev: amplify.Branch


domain = amplify_app.add_domain("example.com",
    enable_auto_subdomain=True,  # in case subdomains should be auto registered for branches
    auto_subdomain_creation_patterns=["*", "pr*"]
)
domain.map_root(master) # map master branch to domain root
domain.map_sub_domain(master, "www")
domain.map_sub_domain(dev)
Parameters:
  • scope (Construct) –

  • id (str) –

  • app (IApp) – (experimental) The application to which the domain must be connected.

  • auto_sub_domain_iam_role (Optional[IRole]) – (experimental) The IAM role with access to Route53 when using enableAutoSubdomain. Default: the IAM role from App.grantPrincipal

  • auto_subdomain_creation_patterns (Optional[Sequence[str]]) – (experimental) Branches which should automatically create subdomains. Default: - all repository branches [‘*’, ‘pr*’]

  • domain_name (Optional[str]) – (experimental) The name of the domain. Default: - the construct’s id

  • enable_auto_subdomain (Optional[bool]) – (experimental) Automatically create subdomains for connected branches. Default: false

  • sub_domains (Optional[Sequence[Union[SubDomain, Dict[str, Any]]]]) – (experimental) Subdomains. Default: - use addSubDomain() to add subdomains

Stability:

experimental

Methods

apply_removal_policy(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).

Parameters:

policy (RemovalPolicy) –

Return type:

None

map_root(branch)

(experimental) Maps a branch to the domain root.

Parameters:

branch (IBranch) –

Stability:

experimental

Return type:

Domain

map_sub_domain(branch, prefix=None)

(experimental) Maps a branch to a sub domain.

Parameters:
  • branch (IBranch) – The branch.

  • prefix (Optional[str]) – The prefix. Use ‘’ to map to the root of the domain. Defaults to branch name.

Stability:

experimental

Return type:

Domain

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

arn

(experimental) The ARN of the domain.

Stability:

experimental

Attribute:

true

certificate_record

(experimental) The DNS Record for certificate verification.

Stability:

experimental

Attribute:

true

domain_auto_sub_domain_creation_patterns

(experimental) Branch patterns for the automatically created subdomain.

Stability:

experimental

Attribute:

true

domain_auto_sub_domain_iam_role

(experimental) The IAM service role for the subdomain.

Stability:

experimental

Attribute:

true

domain_enable_auto_sub_domain

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

Stability:

experimental

Attribute:

true

domain_name

(experimental) The name of the domain.

Stability:

experimental

Attribute:

true

domain_status

(experimental) The status of the domain association.

Stability:

experimental

Attribute:

true

env

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

The construct tree node associated with this construct.

stack

The stack in which this resource is defined.

status_reason

(experimental) The reason for the current status of the domain.

Stability:

experimental

Attribute:

true

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool