Skip to main content

Domain

The cloud.Domain resource represents a domain configuration in the cloud.

Usage

Defining a domain

bring cloud;

let domain = new cloud.Domain(
domainName: "www.example.com",
);

new cloud.Website(path: "./site", domain: domain);

Target-specific details

Simulator (sim)

Under the hood, the simulator stores the domain value in memory.

Note that domain data is not persisted between simulator runs.

AWS (tf-aws and awscdk)

The AWS implementation of cloud.Domain requires certain platform-specific values such as the hostedZoneId and either iamCertificate or acmCertificateArn to be provided.

To provide these values, there are two options. You can either pass the values in the command line or you can provide a TOML file with the configurations:

wing compile -t tf-aws main.w --value root/Default/Default/Domain/acmCertificateArn=arn:aws:acm:us-east-1:111111111111:certificate/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee --value root/Default/Default/Domain/hostedZoneId=Z0111111111111111111F

Alternatively, create a wing.toml file in your project directory:

[root.Default.Default.Domain]
hostedZoneId = "Z0XXXXXXXXXXXXXXXXXXF"
acmCertificateArn = "arn:aws:acm:us-east-1:111111111111:certificate/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee"

Azure (tf-azure)

🚧 Not supported yet

GCP (tf-gcp)

🚧 Not supported yet## API Reference

Domain

A cloud Domain.

Initializers

bring cloud;

new cloud.Domain(props: DomainProps);
NameTypeDescription
props
DomainProps
No description.

propsRequired

Static Functions

NameDescription
onLiftType
A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.
toInflight
Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

onLiftType
bring cloud;

cloud.Domain.onLiftType(host: IInflightHost, ops: MutArray<str>);

A hook called by the Wing compiler once for each inflight host that needs to use this type inflight.

The list of requested inflight methods needed by the inflight host are given by ops.

This method is commonly used for adding permissions, environment variables, or other capabilities to the inflight host.

hostRequired

opsRequired
  • Type: MutArray<str>

toInflight
bring cloud;

cloud.Domain.toInflight(obj: IResource);

Generates an asynchronous JavaScript statement which can be used to create an inflight client for a resource.

NOTE: This statement must be executed within an async context.

objRequired

Properties

NameTypeDescription
node
constructs.NodeThe tree node.
domainName
strThe domain name.

nodeRequired
node: Node;
  • Type: constructs.Node

The tree node.


domainNameRequired
domainName: str;
  • Type: str

The domain name.


Structs

DomainProps

Options for Domain.

Initializer

bring cloud;

let DomainProps = cloud.DomainProps{ ... };

Properties

NameTypeDescription
domainName
strThe website's custom domain name.

domainNameRequired
domainName: str;
  • Type: str

The website's custom domain name.


Example

"example.com"