# PrivateHostedZone

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.

Extends: Construct › Resource › HostedZone › PrivateHostedZone
Implements: IResource, IHostedZone, INamedHostedZoneRef, IPrivateHostedZone, IEnvironmentAware, IHostedZoneRef, IConstruct, IDependable

- CloudFormation: [`AWS::Route53::HostedZone`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-route53-hostedzone.html)
- L1 type: [`CfnHostedZone`](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.CfnHostedZone.html)
- Source: [`aws-route53/lib/hosted-zone.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-route53/lib/hosted-zone.ts#L578)
- Type last changed: v2.220.0 · 14 Oct 2025

## Example

```ts
const privateZoneFromAttributes = route53.PrivateHostedZone.fromPrivateHostedZoneAttributes(this, 'MyPrivateZone', {
  zoneName: 'example.local',
  hostedZoneId: 'ZOJJZC49E0EPZ',
});

// Does not know zoneName
const privateZoneFromId = route53.PrivateHostedZone.fromPrivateHostedZoneId(this, 'MyPrivateZone', 'ZOJJZC49E0EPZ');
```

## Initializer

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

## Construct Props

- `addTrailingDot`: boolean = true — Whether to add a trailing dot to the zone name.

- `comment`: string = none — Any comments that you want to include about the hosted zone.

- `queryLogsLogGroupArn`: string = disabled — The Amazon Resource Name (ARN) for the log group that you want Amazon Route 53 to send query logs to.

- `vpc`: [IVpc](/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.IVpc.html) (required) — 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`: string (required) — The name of the domain.

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

## Properties

- `env`: [ResourceEnvironment](/cdk/api/v2/docs/aws-cdk-lib.interfaces.ResourceEnvironment.html) — The environment this resource belongs to.

  For resources that are created and managed in a Stack (those created by
  creating new class instances like `new Role()`, `new Bucket()`, etc.), this
  is always the same as the environment of the stack they belong to.

  For referenced resources (those obtained from referencing methods like
  `Role.fromRoleArn()`, `Bucket.fromBucketName()`, etc.), they might be
  different than the stack they were imported into.

- `grants`: [HostedZoneGrants](/cdk/api/v2/docs/aws-cdk-lib.aws_route53.HostedZoneGrants.html) — Grants helper for this hosted zone.

- `hostedZoneArn`: string — ARN of this hosted zone, such as arn:${Partition}:route53:::hostedzone/${Id}.

- `hostedZoneId`: string — ID of this hosted zone, such as "Z23ABC4XYZL05B".

- `hostedZoneNameServers`: string[] — 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.

- `hostedZoneRef`: [HostedZoneReference](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_route53.HostedZoneReference.html) — A reference to a HostedZone resource.

- `name`: string — FQDN of this hosted zone.

- `node`: [Node](/cdk/api/v2/docs/constructs.Node.html) — The tree node.

- `PROPERTY_INJECTION_ID`: string (static) — Uniquely identifies this class.

- `stack`: [Stack](/cdk/api/v2/docs/aws-cdk-lib.Stack.html) — The stack in which this resource is defined.

- `zoneName`: string — FQDN of this hosted zone.

## Methods

- `addVpc(vpc: IVpc): void` — Add another VPC to this private hosted zone.

  **Parameters**

  - `vpc` — the other VPC to add.

- `applyCrossStackReferenceStrength(strength: ReferenceStrength): void` — Override the cross-stack reference strength for this resource.

  When set, any cross-stack reference to this resource will use the specified
  mechanism instead of the global default determined by the
  `@aws-cdk/core:defaultCrossStackReferences` context key. This is useful for
  selectively weakening specific references to avoid the "deadly embrace" problem
  without changing the app-wide default.

  **Parameters**

  - `strength` — - The reference strength to use for this resource.

- `applyRemovalPolicy(policy: RemovalPolicy): void` — 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`).

- `enableDnssec(options: ZoneSigningOptions): IKeySigningKey` — Enable DNSSEC for this hosted zone.

  This will create a key signing key with the given options and enable DNSSEC signing
  for the hosted zone.

- `fromHostedZoneAttributes(scope: Construct, id: string, attrs: HostedZoneAttributes): IHostedZone` (static) — Imports a hosted zone from another stack.

  Use when both hosted zone ID and hosted zone name are known.

  **Parameters**

  - `scope` — the parent Construct for this Construct.
  - `id` — the logical name of this Construct.
  - `attrs` — the HostedZoneAttributes (hosted zone ID and hosted zone name).

- `fromHostedZoneId(scope: Construct, id: string, hostedZoneId: string): IHostedZone` (static) — Import a Route 53 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 the HostedZone should be imported with `fromHostedZoneAttributes()` or `fromLookup()`

  **Parameters**

  - `scope` — the parent Construct for this Construct.
  - `id` — the logical name of this Construct.
  - `hostedZoneId` — the ID of the hosted zone to import.

- `fromLookup(scope: Construct, id: string, query: HostedZoneProviderProps): IHostedZone` (static) — Lookup a hosted zone in the current account/region based on query parameters.

  Requires environment, you must specify env for the stack.

  Use to easily query hosted zones.

- `fromPrivateHostedZoneAttributes(scope: Construct, id: string, attrs: PrivateHostedZoneAttributes): IPrivateHostedZone` (static) — Imports a private hosted zone from another stack.

  Use when both hosted zone ID and hosted zone name are known.

  **Parameters**

  - `scope` — the parent Construct for this Construct.
  - `id` — the logical name of this Construct.
  - `attrs` — the PrivateHostedZoneAttributes (hosted zone ID and hosted zone name).

- `fromPrivateHostedZoneId(scope: Construct, id: string, privateHostedZoneId: string): IPrivateHostedZone` (static) — 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.

  **Parameters**

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

- `grantDelegation(grantee: IGrantable, options?: GrantDelegationOptions): Grant` — [disable-awslint:no-grants].

- `isConstruct(x: any): boolean` (static) — Checks if `x` is a construct.

  Use this method instead of `instanceof` to properly detect `Construct`
  instances, even when the construct library is symlinked.

  Explanation: in JavaScript, multiple copies of the `constructs` library on
  disk are seen as independent, completely different libraries. As a
  consequence, the class `Construct` in each copy of the `constructs` library
  is seen as a different class, and an instance of one class will not test as
  `instanceof` the other class. `npm install` will not create installations
  like this, but users may manually symlink construct libraries together or
  use a monorepo tool: in those cases, multiple copies of the `constructs`
  library can be accidentally installed, and `instanceof` will behave
  unpredictably. It is safest to avoid using `instanceof`, and using
  this type-testing method instead.

  **Parameters**

  - `x` — Any object.

  **Returns:** true if `x` is an object created from a class which extends `Construct`.

- `isOwnedResource(construct: IConstruct): boolean` (static) — Returns true if the construct was created by CDK, and false otherwise.

- `isResource(construct: IConstruct): boolean` (static) — Check whether the given construct is a Resource.

- `toString(): string` — Returns a string representation of this construct.

- `with(...mixins: IMixin[]): IConstruct` — Applies one or more mixins to this construct.

  Mixins are applied in order. The list of constructs is captured at the
  start of the call, so constructs added by a mixin will not be visited.
  Use multiple `with()` calls if subsequent mixins should apply to added
  constructs.
