Class HostedZone

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

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:43.012Z") @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:

 HostedZone hostedZone = HostedZone.Builder.create(this, "MyHostedZone").zoneName("example.org").build();
 Metric metric = Metric.Builder.create()
         .namespace("AWS/Route53")
         .metricName("DNSQueries")
         .dimensionsMap(Map.of(
                 "HostedZoneId", hostedZone.getHostedZoneId()))
         .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. Hosted zone name becomes unavailable through this query.

      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.
    • 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