@aws-cdk_aws-apigatewayv2-alpha.DomainName

class DomainName (construct) ๐Ÿ”น

LanguageType name
.NETAmazon.CDK.AWS.Apigatewayv2.Alpha.DomainName
Gogithub.com/aws/aws-cdk-go/awscdkapigatewayv2alpha/v2#DomainName
Javasoftware.amazon.awscdk.services.apigatewayv2.alpha.DomainName
Pythonaws_cdk.aws_apigatewayv2_alpha.DomainName
TypeScript (source)@aws-cdk/aws-apigatewayv2-alpha ยป DomainName

Implements IConstruct, IDependable, IResource, IDomainName

Custom domain resource for the API.

Example

import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import { HttpLambdaIntegration } from '@aws-cdk/aws-apigatewayv2-integrations-alpha';

const certArn = 'arn:aws:acm:us-east-1:111111111111:certificate';
const domainName = 'example.com';

const dn = new apigwv2.DomainName(this, 'DN', {
  domainName: domainName,
  certificate: acm.Certificate.fromCertificateArn(this, 'cert', certArn),
});

declare const handler: lambda.Function;
const api = new apigwv2.HttpApi(this, 'HttpProxyProdApi', {
  defaultIntegration: new HttpLambdaIntegration('DefaultIntegration', handler),
  // https://${dn.domainName}/foo goes to prodApi $default stage
  defaultDomainMapping: {
    domainName: dn,
    mappingKey: 'foo',
  },
});

Initializer

new DomainName(scope: Construct, id: string, props: DomainNameProps)

Parameters

  • scope Construct
  • id string
  • props DomainNameProps

Construct Props

NameTypeDescription
certificate๐Ÿ”นICertificateThe ACM certificate for this domain name.
domainName๐Ÿ”นstringThe custom domain name.
certificateName?๐Ÿ”นstringThe user-friendly name of the certificate that will be used by the endpoint for this domain name.
endpointType?๐Ÿ”นEndpointTypeThe type of endpoint for this DomainName.
mtls?๐Ÿ”นMTLSConfigThe mutual TLS authentication configuration for a custom domain name.
ownershipCertificate?๐Ÿ”นICertificateA public certificate issued by ACM to validate that you own a custom domain.
securityPolicy?๐Ÿ”นSecurityPolicyThe Transport Layer Security (TLS) version + cipher suite for this domain name.

certificate๐Ÿ”น

Type: ICertificate

The ACM certificate for this domain name.

Certificate can be both ACM issued or imported.


domainName๐Ÿ”น

Type: string

The custom domain name.


certificateName?๐Ÿ”น

Type: string (optional, default: No friendly certificate name)

The user-friendly name of the certificate that will be used by the endpoint for this domain name.


endpointType?๐Ÿ”น

Type: EndpointType (optional, default: EndpointType.REGIONAL)

The type of endpoint for this DomainName.


mtls?๐Ÿ”น

Type: MTLSConfig (optional, default: mTLS is not configured.)

The mutual TLS authentication configuration for a custom domain name.


ownershipCertificate?๐Ÿ”น

Type: ICertificate (optional, default: only required when configuring mTLS)

A public certificate issued by ACM to validate that you own a custom domain.

This parameter is required only when you configure mutual TLS authentication and you specify an ACM imported or private CA certificate for certificate. The ownership certificate validates that you have permissions to use the domain name.


securityPolicy?๐Ÿ”น

Type: SecurityPolicy (optional, default: SecurityPolicy.TLS_1_2)

The Transport Layer Security (TLS) version + cipher suite for this domain name.

Properties

NameTypeDescription
env๐Ÿ”นResourceEnvironmentThe environment this resource belongs to.
name๐Ÿ”นstringThe custom domain name.
node๐Ÿ”นNodeThe tree node.
regionalDomainName๐Ÿ”นstringThe domain name associated with the regional endpoint for this custom domain name.
regionalHostedZoneId๐Ÿ”นstringThe region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint.
stack๐Ÿ”นStackThe stack in which this resource is defined.

env๐Ÿ”น

Type: ResourceEnvironment

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.


name๐Ÿ”น

Type: string

The custom domain name.


node๐Ÿ”น

Type: Node

The tree node.


regionalDomainName๐Ÿ”น

Type: string

The domain name associated with the regional endpoint for this custom domain name.


regionalHostedZoneId๐Ÿ”น

Type: string

The region-specific Amazon Route 53 Hosted Zone ID of the regional endpoint.


stack๐Ÿ”น

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addEndpoint(options)๐Ÿ”นAdds an endpoint to a domain name.
applyRemovalPolicy(policy)๐Ÿ”นApply the given removal policy to this resource.
toString()๐Ÿ”นReturns a string representation of this construct.
static fromDomainNameAttributes(scope, id, attrs)๐Ÿ”นImport from attributes.

addEndpoint(options)๐Ÿ”น

public addEndpoint(options: EndpointOptions): void

Parameters

  • options EndpointOptions โ€” domain name endpoint properties to be set.

Adds an endpoint to a domain name.


applyRemovalPolicy(policy)๐Ÿ”น

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

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


toString()๐Ÿ”น

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromDomainNameAttributes(scope, id, attrs)๐Ÿ”น

public static fromDomainNameAttributes(scope: Construct, id: string, attrs: DomainNameAttributes): IDomainName

Parameters

  • scope Construct
  • id string
  • attrs DomainNameAttributes

Returns

  • IDomainName

Import from attributes.