> **Experimental**
>
> `@aws-cdk/aws-amplify-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# DomainOptions

Options to add a domain to an application.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/domain.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0/packages/@aws-cdk/aws-amplify-alpha/lib/domain.ts#L16)

## Example

TypeScript:

```ts
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
```

Python:

```python
# amplify_app: amplify.App
# main: 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(main) # map main branch to domain root
domain.map_sub_domain(main, "www")
domain.map_sub_domain(dev)
```

Java:

```java
App amplifyApp;
Branch main;
Branch dev;

Domain domain = amplifyApp.addDomain("example.com", DomainOptions.builder()
        .enableAutoSubdomain(true) // in case subdomains should be auto registered for branches
        .autoSubdomainCreationPatterns(List.of("*", "pr*"))
        .build());
domain.mapRoot(main); // map main branch to domain root
domain.mapSubDomain(main, "www");
domain.mapSubDomain(dev);
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Amplify.Alpha
App amplifyApp;
Branch main;
Branch dev;

var domain = amplifyApp.AddDomain("example.com", new DomainOptions {
    EnableAutoSubdomain = true,  // in case subdomains should be auto registered for branches
    AutoSubdomainCreationPatterns = new [] { "*", "pr*" }
});
domain.MapRoot(main); // map main branch to domain root
domain.MapSubDomain(main, "www");
domain.MapSubDomain(dev);
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkamplifyalpha/v2
var amplifyApp App
var main Branch
var dev Branch

domain := amplifyApp.AddDomain(jsii.String("example.com"), &DomainOptions{
	EnableAutoSubdomain: jsii.Boolean(true),
	 // in case subdomains should be auto registered for branches
	AutoSubdomainCreationPatterns: []*string{
		jsii.String("*"),
		jsii.String("pr*"),
	},
})
domain.MapRoot(main) // map main branch to domain root
domain.MapSubDomain(main, jsii.String("www"))
domain.MapSubDomain(dev)
```

## Properties

- `autoSubdomainCreationPatterns`: string[] — Branches which should automatically create subdomains.

  **Default:** all repository branches ['*', 'pr*']

- `customCertificate`: [ICertificate](/cdk/api/v2/docs/aws-cdk-lib.aws_certificatemanager.ICertificate.html) — The type of SSL/TLS certificate to use for your custom domain.

  **Default:** Amplify uses the default certificate that it provisions and manages for you

- `domainName`: string — The name of the domain.

  **Default:** the construct's id

- `enableAutoSubdomain`: boolean = false — Automatically create subdomains for connected branches.

- `subDomains`: [SubDomain](/cdk/api/v2/docs/@aws-cdk_aws-amplify-alpha.SubDomain.html)[] — Subdomains.

  **Default:** use `addSubDomain()` to add subdomains
