aws-cdk-lib.aws_route53.PrivateHostedZone

class PrivateHostedZone (construct)

LanguageType name
.NETAmazon.CDK.AWS.Route53.PrivateHostedZone
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsroute53#PrivateHostedZone
Javasoftware.amazon.awscdk.services.route53.PrivateHostedZone
Pythonaws_cdk.aws_route53.PrivateHostedZone
TypeScript (source)aws-cdk-lib » aws_route53 » PrivateHostedZone

Implements IConstruct, IDependable, IResource, IHostedZone, IPrivateHostedZone

Create a Route53 private hosted zone for use in one or more VPCs.

Note that enableDnsHostnames and enableDnsSupport must have been enabled for the VPC you're configuring for private hosted zones.

Example

declare const vpc: ec2.Vpc;

const zone = new route53.PrivateHostedZone(this, 'HostedZone', {
  zoneName: 'fully.qualified.domain.com',
  vpc,    // At least one VPC has to be added to a Private Hosted Zone.
});

Initializer

new PrivateHostedZone(scope: Construct, id: string, props: PrivateHostedZoneProps)

Parameters

  • scope Construct
  • id string
  • props PrivateHostedZoneProps

Construct Props

NameTypeDescription
vpcIVpcA VPC that you want to associate with this hosted zone.
zoneNamestringThe name of the domain.
addTrailingDot?booleanWhether to add a trailing dot to the zone name.
comment?stringAny comments that you want to include about the hosted zone.
queryLogsLogGroupArn?stringThe Amazon Resource Name (ARN) for the log group that you want Amazon Route 53 to send query logs to.

vpc

Type: IVpc

A VPC that you want to associate with this hosted zone.

Private hosted zones must be associated with at least one VPC. You can associated additional VPCs using addVpc(vpc).


zoneName

Type: string

The name of the domain.

For resource record types that include a domain name, specify a fully qualified domain name.


addTrailingDot?

Type: boolean (optional, default: true)

Whether to add a trailing dot to the zone name.


comment?

Type: string (optional, default: none)

Any comments that you want to include about the hosted zone.


queryLogsLogGroupArn?

Type: string (optional, default: disabled)

The Amazon Resource Name (ARN) for the log group that you want Amazon Route 53 to send query logs to.

Properties

NameTypeDescription
envResourceEnvironmentThe environment this resource belongs to.
hostedZoneArnstringARN of this hosted zone, such as arn:${Partition}:route53:::hostedzone/${Id}.
hostedZoneIdstringID of this hosted zone, such as "Z23ABC4XYZL05B".
nodeNodeThe tree node.
stackStackThe stack in which this resource is defined.
zoneNamestringFQDN of this hosted zone.
hostedZoneNameServers?string[]Returns the set of name servers for the specific hosted zone. For example: ns1.example.com.

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.


hostedZoneArn

Type: string

ARN of this hosted zone, such as arn:${Partition}:route53:::hostedzone/${Id}.


hostedZoneId

Type: string

ID of this hosted zone, such as "Z23ABC4XYZL05B".


node

Type: Node

The tree node.


stack

Type: Stack

The stack in which this resource is defined.


zoneName

Type: string

FQDN of this hosted zone.


hostedZoneNameServers?

Type: string[] (optional)

Returns the set of name servers for the specific hosted zone. For example: ns1.example.com.

This attribute will be undefined for private hosted zones or hosted zones imported from another stack.

Methods

NameDescription
addVpc(vpc)Add another VPC to this private hosted zone.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
toString()Returns a string representation of this construct.
static fromPrivateHostedZoneId(scope, id, privateHostedZoneId)Import a Route 53 private hosted zone defined either outside the CDK, or in a different CDK stack.

addVpc(vpc)

public addVpc(vpc: IVpc): void

Parameters

  • vpc IVpc — the other VPC to add.

Add another VPC to this private hosted zone.


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 fromPrivateHostedZoneId(scope, id, privateHostedZoneId)

public static fromPrivateHostedZoneId(scope: Construct, id: string, privateHostedZoneId: string): IPrivateHostedZone

Parameters

  • scope Construct — the parent Construct for this Construct.
  • id string — the logical name of this Construct.
  • privateHostedZoneId string — the ID of the private hosted zone to import.

Returns

  • IPrivateHostedZone

Import a Route 53 private hosted zone defined either outside the CDK, or in a different CDK stack.

Use when hosted zone ID is known. If a HostedZone is imported with this method the zoneName cannot be referenced. If the zoneName is needed then you cannot import a PrivateHostedZone.