Class HostedZone
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).
Inherited Members
Namespace: Amazon.CDK.AWS.Route53
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class HostedZone : Resource, IHostedZone, IResource, IConstruct, IDependable
Syntax (vb)
Public Class HostedZone Inherits Resource Implements IHostedZone, IResource, IConstruct, IDependable
Remarks
ExampleMetadata: infused
Examples
var exampleCom = new HostedZone(this, "ExampleCom", new HostedZoneProps {
ZoneName = "example.com"
});
var exampleNet = new HostedZone(this, "ExampleNet", new HostedZoneProps {
ZoneName = "example.net"
});
var cert = new Certificate(this, "Certificate", new CertificateProps {
DomainName = "test.example.com",
SubjectAlternativeNames = new [] { "cool.example.com", "test.example.net" },
Validation = CertificateValidation.FromDnsMultiZone(new Dictionary<string, IHostedZone> {
{ "test.example.com", exampleCom },
{ "cool.example.com", exampleCom },
{ "test.example.net", exampleNet }
})
});
Synopsis
Constructors
HostedZone(Construct, string, IHostedZoneProps) | 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). |
Properties
HostedZoneArn | ARN of this hosted zone, such as arn:\({Partition}:route53:::hostedzone/\){Id}. |
HostedZoneId | ID of this hosted zone, such as "Z23ABC4XYZL05B". |
HostedZoneNameServers | Returns the set of name servers for the specific hosted zone. For example: ns1.example.com. |
PROPERTY_INJECTION_ID | Uniquely identifies this class. |
Vpcs | VPCs to which this hosted zone will be added. |
ZoneName | FQDN of this hosted zone. |
Methods
AddVpc(IVpc) | Add another VPC to this private hosted zone. |
EnableDnssec(IZoneSigningOptions) | Enable DNSSEC for this hosted zone. |
FromHostedZoneAttributes(Construct, string, IHostedZoneAttributes) | Imports a hosted zone from another stack. |
FromHostedZoneId(Construct, string, string) | Import a Route 53 hosted zone defined either outside the CDK, or in a different CDK stack. |
FromLookup(Construct, string, IHostedZoneProviderProps) | Lookup a hosted zone in the current account/region based on query parameters. |
GrantDelegation(IGrantable) | Grant permissions to add delegation records to this zone. |
Constructors
HostedZone(Construct, string, IHostedZoneProps)
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).
public HostedZone(Construct scope, string id, IHostedZoneProps props)
Parameters
- scope Construct
- id string
- props IHostedZoneProps
Remarks
ExampleMetadata: infused
Examples
var exampleCom = new HostedZone(this, "ExampleCom", new HostedZoneProps {
ZoneName = "example.com"
});
var exampleNet = new HostedZone(this, "ExampleNet", new HostedZoneProps {
ZoneName = "example.net"
});
var cert = new Certificate(this, "Certificate", new CertificateProps {
DomainName = "test.example.com",
SubjectAlternativeNames = new [] { "cool.example.com", "test.example.net" },
Validation = CertificateValidation.FromDnsMultiZone(new Dictionary<string, IHostedZone> {
{ "test.example.com", exampleCom },
{ "cool.example.com", exampleCom },
{ "test.example.net", exampleNet }
})
});
Properties
HostedZoneArn
ARN of this hosted zone, such as arn:\({Partition}:route53:::hostedzone/\){Id}.
public virtual string HostedZoneArn { get; }
Property Value
Remarks
ExampleMetadata: infused
HostedZoneId
ID of this hosted zone, such as "Z23ABC4XYZL05B".
public virtual string HostedZoneId { get; }
Property Value
Remarks
ExampleMetadata: infused
HostedZoneNameServers
Returns the set of name servers for the specific hosted zone. For example: ns1.example.com.
public virtual string[]? HostedZoneNameServers { get; }
Property Value
string[]
Remarks
This attribute will be undefined for private hosted zones or hosted zones imported from another stack.
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
Remarks
ExampleMetadata: infused
Vpcs
VPCs to which this hosted zone will be added.
protected virtual CfnHostedZone.IVPCProperty[] Vpcs { get; }
Property Value
Remarks
ExampleMetadata: infused
ZoneName
FQDN of this hosted zone.
public virtual string ZoneName { get; }
Property Value
Remarks
ExampleMetadata: infused
Methods
AddVpc(IVpc)
Add another VPC to this private hosted zone.
public virtual void AddVpc(IVpc vpc)
Parameters
- vpc IVpc
the other VPC to add.
Remarks
ExampleMetadata: infused
EnableDnssec(IZoneSigningOptions)
Enable DNSSEC for this hosted zone.
public virtual IKeySigningKey EnableDnssec(IZoneSigningOptions options)
Parameters
- options IZoneSigningOptions
Returns
Remarks
This will create a key signing key with the given options and enable DNSSEC signing for the hosted zone.
FromHostedZoneAttributes(Construct, string, IHostedZoneAttributes)
Imports a hosted zone from another stack.
public static IHostedZone FromHostedZoneAttributes(Construct scope, string id, IHostedZoneAttributes attrs)
Parameters
- scope Construct
the parent Construct for this Construct.
- id string
the logical name of this Construct.
- attrs IHostedZoneAttributes
the HostedZoneAttributes (hosted zone ID and hosted zone name).
Returns
Remarks
Use when both hosted zone ID and hosted zone name are known.
FromHostedZoneId(Construct, string, string)
Import a Route 53 hosted zone defined either outside the CDK, or in a different CDK stack.
public static IHostedZone FromHostedZoneId(Construct scope, string id, string hostedZoneId)
Parameters
- scope Construct
the parent Construct for this Construct.
- id string
the logical name of this Construct.
- hostedZoneId string
the ID of the hosted zone to import.
Returns
Remarks
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()
FromLookup(Construct, string, IHostedZoneProviderProps)
Lookup a hosted zone in the current account/region based on query parameters.
public static IHostedZone FromLookup(Construct scope, string id, IHostedZoneProviderProps query)
Parameters
- scope Construct
- id string
- query IHostedZoneProviderProps
Returns
Remarks
Requires environment, you must specify env for the stack.
Use to easily query hosted zones.
See: https://docs.aws.amazon.com/cdk/latest/guide/environments.html
GrantDelegation(IGrantable)
Grant permissions to add delegation records to this zone.
public virtual Grant GrantDelegation(IGrantable grantee)
Parameters
- grantee IGrantable
Returns
Remarks
ExampleMetadata: infused