Class CfnHostedZone

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-08T21:35:12.934Z") @Stability(Stable) public class CfnHostedZone extends CfnResource implements IInspectable, ITaggable
Creates a new public or private hosted zone.

You create records in a public hosted zone to define how you want to route traffic on the internet for a domain, such as example.com, and its subdomains (apex.example.com, acme.example.com). You create records in a private hosted zone to define how you want to route traffic for a domain and its subdomains within one or more Amazon Virtual Private Clouds (Amazon VPCs).

You can't convert a public hosted zone to a private hosted zone or vice versa. Instead, you must create a new hosted zone with the same name and create new resource record sets.

For more information about charges for hosted zones, see Amazon Route 53 Pricing .

Note the following:

  • You can't create a hosted zone for a top-level domain (TLD) such as .com.
  • If your domain is registered with a registrar other than Route 53, you must update the name servers with your registrar to make Route 53 the DNS service for the domain. For more information, see Migrating DNS Service for an Existing Domain to Amazon Route 53 in the Amazon Route 53 Developer Guide .

When you submit a CreateHostedZone request, the initial status of the hosted zone is PENDING . For public hosted zones, this means that the NS and SOA records are not yet available on all Route 53 DNS servers. When the NS and SOA records are available, the status of the zone changes to INSYNC .

The CreateHostedZone request requires the caller to have an ec2:DescribeVpcs permission.

When creating private hosted zones, the Amazon VPC must belong to the same partition where the hosted zone is created. A partition is a group of AWS Regions . Each AWS account is scoped to one partition.

The following are the supported partitions:

  • aws - AWS Regions
  • aws-cn - China Regions
  • aws-us-gov - AWS GovCloud (US) Region

For more information, see Access Management in the AWS General Reference .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.services.route53.*;
 CfnHostedZone cfnHostedZone = CfnHostedZone.Builder.create(this, "MyCfnHostedZone")
         .hostedZoneConfig(HostedZoneConfigProperty.builder()
                 .comment("comment")
                 .build())
         .hostedZoneTags(List.of(HostedZoneTagProperty.builder()
                 .key("key")
                 .value("value")
                 .build()))
         .name("name")
         .queryLoggingConfig(QueryLoggingConfigProperty.builder()
                 .cloudWatchLogsLogGroupArn("cloudWatchLogsLogGroupArn")
                 .build())
         .vpcs(List.of(VPCProperty.builder()
                 .vpcId("vpcId")
                 .vpcRegion("vpcRegion")
                 .build()))
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnHostedZone

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

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

      @Stability(Stable) public CfnHostedZone(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnHostedZoneProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties.
    • CfnHostedZone

      @Stability(Stable) public CfnHostedZone(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrId

      @Stability(Stable) @NotNull public String getAttrId()
      The ID that Amazon Route 53 assigned to the hosted zone when you created it.
    • getAttrNameServers

      @Stability(Stable) @NotNull public List<String> getAttrNameServers()
      Returns the set of name servers for the specific hosted zone. For example: ns1.example.com .

      This attribute is not supported for private hosted zones.

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getHostedZoneConfig

      @Stability(Stable) @Nullable public Object getHostedZoneConfig()
      A complex type that contains an optional comment.
    • setHostedZoneConfig

      @Stability(Stable) public void setHostedZoneConfig(@Nullable IResolvable value)
      A complex type that contains an optional comment.
    • setHostedZoneConfig

      @Stability(Stable) public void setHostedZoneConfig(@Nullable CfnHostedZone.HostedZoneConfigProperty value)
      A complex type that contains an optional comment.
    • getHostedZoneTagsRaw

      @Stability(Stable) @Nullable public List<CfnHostedZone.HostedZoneTagProperty> getHostedZoneTagsRaw()
      Adds, edits, or deletes tags for a health check or a hosted zone.
    • setHostedZoneTagsRaw

      @Stability(Stable) public void setHostedZoneTagsRaw(@Nullable List<CfnHostedZone.HostedZoneTagProperty> value)
      Adds, edits, or deletes tags for a health check or a hosted zone.
    • getName

      @Stability(Stable) @Nullable public String getName()
      The name of the domain.
    • setName

      @Stability(Stable) public void setName(@Nullable String value)
      The name of the domain.
    • getQueryLoggingConfig

      @Stability(Stable) @Nullable public Object getQueryLoggingConfig()
      Creates a configuration for DNS query logging.
    • setQueryLoggingConfig

      @Stability(Stable) public void setQueryLoggingConfig(@Nullable IResolvable value)
      Creates a configuration for DNS query logging.
    • setQueryLoggingConfig

      @Stability(Stable) public void setQueryLoggingConfig(@Nullable CfnHostedZone.QueryLoggingConfigProperty value)
      Creates a configuration for DNS query logging.
    • getVpcs

      @Stability(Stable) @Nullable public Object getVpcs()
      Private hosted zones: A complex type that contains information about the VPCs that are associated with the specified hosted zone.
    • setVpcs

      @Stability(Stable) public void setVpcs(@Nullable IResolvable value)
      Private hosted zones: A complex type that contains information about the VPCs that are associated with the specified hosted zone.
    • setVpcs

      @Stability(Stable) public void setVpcs(@Nullable List<Object> value)
      Private hosted zones: A complex type that contains information about the VPCs that are associated with the specified hosted zone.