DomainNameProps

class aws_cdk.aws_apigatewayv2.DomainNameProps(*, certificate, certificate_name=None, endpoint_type=None, ownership_certificate=None, security_policy=None, domain_name, mtls=None)

Bases: EndpointOptions

properties used for creating the DomainName.

Parameters:
  • certificate (ICertificate) – The ACM certificate for this domain name. Certificate can be both ACM issued or imported.

  • certificate_name (Optional[str]) – The user-friendly name of the certificate that will be used by the endpoint for this domain name. Default: - No friendly certificate name

  • endpoint_type (Optional[EndpointType]) – The type of endpoint for this DomainName. Default: EndpointType.REGIONAL

  • ownership_certificate (Optional[ICertificate]) – 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. Default: - only required when configuring mTLS

  • security_policy (Optional[SecurityPolicy]) – The Transport Layer Security (TLS) version + cipher suite for this domain name. Default: SecurityPolicy.TLS_1_2

  • domain_name (str) – The custom domain name.

  • mtls (Union[MTLSConfig, Dict[str, Any], None]) – The mutual TLS authentication configuration for a custom domain name. Default: - mTLS is not configured.

ExampleMetadata:

infused

Example:

import aws_cdk.aws_certificatemanager as acm
from aws_cdk.aws_apigatewayv2_integrations import HttpLambdaIntegration

# handler: lambda.Function


cert_arn = "arn:aws:acm:us-east-1:111111111111:certificate"
domain_name = "example.com"

dn = apigwv2.DomainName(self, "DN",
    domain_name=domain_name,
    certificate=acm.Certificate.from_certificate_arn(self, "cert", cert_arn)
)
api = apigwv2.HttpApi(self, "HttpProxyProdApi",
    default_integration=HttpLambdaIntegration("DefaultIntegration", handler),
    # https://${dn.domainName}/foo goes to prodApi $default stage
    default_domain_mapping=apigwv2.DomainMappingOptions(
        domain_name=dn,
        mapping_key="foo"
    )
)

Attributes

certificate

The ACM certificate for this domain name.

Certificate can be both ACM issued or imported.

certificate_name

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

Default:
  • No friendly certificate name

domain_name

The custom domain name.

endpoint_type

The type of endpoint for this DomainName.

Default:

EndpointType.REGIONAL

mtls

The mutual TLS authentication configuration for a custom domain name.

Default:
  • mTLS is not configured.

ownership_certificate

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.

Default:
  • only required when configuring mTLS

security_policy

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

Default:

SecurityPolicy.TLS_1_2