Experimental
@aws-cdk/aws-amplify-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
DomainOptions Struct
Options to add a domain to an application.
| Stability | Experimental |
|---|---|
| Source | lib/domain.ts |
Example
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
# 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
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);
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);
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
autoSubdomainCreationPatternsoptionalstring[]auto_subdomain_creation_patternsoptionaltyping.List[str]autoSubdomainCreationPatternsoptionalList<String>AutoSubdomainCreationPatternsoptionalstring[]AutoSubdomainCreationPatternsoptional*[]*string #Branches which should automatically create subdomains.
Default: all repository branches ['', 'pr']
customCertificateoptionalICertificatecustom_certificateoptionalICertificatecustomCertificateoptionalICertificateCustomCertificateoptionalICertificateCustomCertificateoptionalICertificate #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
domainNameoptionalstringdomain_nameoptionalstrdomainNameoptionalStringDomainNameoptionalstringDomainNameoptional*string #The name of the domain.
Default: the construct's id
enableAutoSubdomainoptionalbooleanenable_auto_subdomainoptionalboolenableAutoSubdomainoptionalBooleanEnableAutoSubdomainoptionalboolEnableAutoSubdomainoptional*bool = false #Automatically create subdomains for connected branches.