Class HostedZone

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.route53.HostedZone
All Implemented Interfaces:
IResource, IHostedZone, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable
Direct Known Subclasses:
PrivateHostedZone, PublicHostedZone

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-06T23:25:16.077Z") @Stability(Stable) public class HostedZone extends Resource implements IHostedZone
Container for records, and records contain information about how to route traffic for a specific domain, such as example.com and its subdomains (acme.example.com, zenith.example.com).

Example:

 Key kmsKey = Key.Builder.create(this, "KmsCMK")
         .keySpec(KeySpec.ECC_NIST_P256)
         .keyUsage(KeyUsage.SIGN_VERIFY)
         .build();
 HostedZone hostedZone = HostedZone.Builder.create(this, "HostedZone")
         .zoneName("example.com")
         .build();
 // Enable DNSSEC signing for the zone
 hostedZone.enableDnssec(ZoneSigningOptions.builder().kmsKey(kmsKey).build());
 
  • Constructor Details

    • HostedZone

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

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

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

    • fromHostedZoneAttributes

      @Stability(Stable) @NotNull public static IHostedZone fromHostedZoneAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HostedZoneAttributes attrs)
      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. This parameter is required.
      id - the logical name of this Construct. This parameter is required.
      attrs - the HostedZoneAttributes (hosted zone ID and hosted zone name). This parameter is required.
    • fromHostedZoneId

      @Stability(Stable) @NotNull public static IHostedZone fromHostedZoneId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String hostedZoneId)
      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. This parameter is required.
      id - the logical name of this Construct. This parameter is required.
      hostedZoneId - the ID of the hosted zone to import. This parameter is required.
    • fromLookup

      @Stability(Stable) @NotNull public static IHostedZone fromLookup(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull HostedZoneProviderProps query)
      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.

      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      query - This parameter is required.
      See Also:
    • addVpc

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

      Parameters:
      vpc - the other VPC to add. This parameter is required.
    • enableDnssec

      @Stability(Stable) @NotNull public IKeySigningKey enableDnssec(@NotNull ZoneSigningOptions options)
      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.

      Parameters:
      options - This parameter is required.
    • grantDelegation

      @Stability(Stable) @NotNull public Grant grantDelegation(@NotNull IGrantable grantee)
      Grant permissions to add delegation records to this zone.

      Specified by:
      grantDelegation in interface IHostedZone
      Parameters:
      grantee - This parameter is required.
    • getHostedZoneArn

      @Stability(Stable) @NotNull public String getHostedZoneArn()
      ARN of this hosted zone, such as arn:${Partition}:route53:::hostedzone/${Id}.
      Specified by:
      getHostedZoneArn in interface IHostedZone
    • getHostedZoneId

      @Stability(Stable) @NotNull public String getHostedZoneId()
      ID of this hosted zone, such as "Z23ABC4XYZL05B".
      Specified by:
      getHostedZoneId in interface IHostedZone
    • getVpcs

      @Stability(Stable) @NotNull protected List<CfnHostedZone.VPCProperty> getVpcs()
      VPCs to which this hosted zone will be added.
    • getZoneName

      @Stability(Stable) @NotNull public String getZoneName()
      FQDN of this hosted zone.
      Specified by:
      getZoneName in interface IHostedZone
    • getHostedZoneNameServers

      @Stability(Stable) @Nullable public List<String> getHostedZoneNameServers()
      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.

      Specified by:
      getHostedZoneNameServers in interface IHostedZone