Class PublicHostedZone

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.route53.HostedZone
software.amazon.awscdk.services.route53.PublicHostedZone
All Implemented Interfaces:
IEnvironmentAware, IHostedZoneRef, IResource, IHostedZone, INamedHostedZoneRef, IPublicHostedZone, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-04-24T20:29:36.077Z") @Stability(Stable) public class PublicHostedZone extends HostedZone implements IPublicHostedZone
Create a Route53 public hosted zone.

Example:

 PublicHostedZone subZone = PublicHostedZone.Builder.create(this, "SubZone")
         .zoneName("sub.someexample.com")
         .build();
 // import the delegation role by constructing the roleArn
 String delegationRoleArn = Stack.of(this).formatArn(ArnComponents.builder()
         .region("") // IAM is global in each partition
         .service("iam")
         .account("parent-account-id")
         .resource("role")
         .resourceName("MyDelegationRole")
         .build());
 IRole delegationRole = Role.fromRoleArn(this, "DelegationRole", delegationRoleArn);
 CrossAccountZoneDelegationRecord.Builder.create(this, "delegate")
         .delegatedZone(subZone)
         .parentHostedZoneName("someexample.com") // or you can use parentHostedZoneId
         .delegationRole(delegationRole)
         .assumeRoleRegion("us-east-1")
         .build();
 
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Stable) public static final String PROPERTY_INJECTION_ID
      Uniquely identifies this class.
  • Constructor Details

    • PublicHostedZone

      protected PublicHostedZone(software.amazon.jsii.JsiiObjectRef objRef)
    • PublicHostedZone

      protected PublicHostedZone(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • PublicHostedZone

      @Stability(Stable) public PublicHostedZone(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PublicHostedZoneProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • fromPublicHostedZoneAttributes

      @Stability(Stable) @NotNull public static IPublicHostedZone fromPublicHostedZoneAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull PublicHostedZoneAttributes attrs)
      Imports a public 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. This parameter is required.
      id - the logical name of this Construct. This parameter is required.
      attrs - the PublicHostedZoneAttributes (hosted zone ID and hosted zone name). This parameter is required.
    • fromPublicHostedZoneId

      @Stability(Stable) @NotNull public static IPublicHostedZone fromPublicHostedZoneId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String publicHostedZoneId)
      Import a Route 53 public hosted zone defined either outside the CDK, or in a different CDK stack.

      Use when hosted zone ID is known. If a PublicHostedZone is imported with this method the zoneName cannot be referenced. If the zoneName is needed then the PublicHostedZone should be imported with fromPublicHostedZoneAttributes().

      Parameters:
      scope - the parent Construct for this Construct. This parameter is required.
      id - the logical name of this Construct. This parameter is required.
      publicHostedZoneId - the ID of the public hosted zone to import. This parameter is required.
    • addDelegation

      @Stability(Stable) public void addDelegation(@NotNull IPublicHostedZone delegate, @Nullable ZoneDelegationOptions opts)
      Adds a delegation from this zone to a designated zone.

      Parameters:
      delegate - the zone being delegated to. This parameter is required.
      opts - options for creating the DNS record, if any.
    • addDelegation

      @Stability(Stable) public void addDelegation(@NotNull IPublicHostedZone delegate)
      Adds a delegation from this zone to a designated zone.

      Parameters:
      delegate - the zone being delegated to. This parameter is required.
    • addVpc

      @Stability(Stable) public void addVpc(@NotNull IVpc _vpc)
      Add another VPC to this private hosted zone.

      Overrides:
      addVpc in class HostedZone
      Parameters:
      _vpc - This parameter is required.
    • getCrossAccountZoneDelegationRole

      @Stability(Stable) @Nullable public Role getCrossAccountZoneDelegationRole()
      Role for cross account zone delegation.