PrivateHostedZone L2 construct
Create a Route53 private hosted zone for use in one or more VPCs.
Note that enableDnsHostnames and enableDnsSupport must have been enabled for the VPC you're configuring for private hosted zones.
Example
const privateZoneFromAttributes = route53.PrivateHostedZone.fromPrivateHostedZoneAttributes(this, 'MyPrivateZone', {
zoneName: 'example.local',
hostedZoneId: 'ZOJJZC49E0EPZ',
});
// Does not know zoneName
const privateZoneFromId = route53.PrivateHostedZone.fromPrivateHostedZoneId(this, 'MyPrivateZone', 'ZOJJZC49E0EPZ');
private_zone_from_attributes = route53.PrivateHostedZone.from_private_hosted_zone_attributes(self, "MyPrivateZone",
zone_name="example.local",
hosted_zone_id="ZOJJZC49E0EPZ"
)
# Does not know zoneName
private_zone_from_id = route53.PrivateHostedZone.from_private_hosted_zone_id(self, "MyPrivateZone", "ZOJJZC49E0EPZ")
IPrivateHostedZone privateZoneFromAttributes = PrivateHostedZone.fromPrivateHostedZoneAttributes(this, "MyPrivateZone", PrivateHostedZoneAttributes.builder()
.zoneName("example.local")
.hostedZoneId("ZOJJZC49E0EPZ")
.build());
// Does not know zoneName
IPrivateHostedZone privateZoneFromId = PrivateHostedZone.fromPrivateHostedZoneId(this, "MyPrivateZone", "ZOJJZC49E0EPZ");
// Install: dotnet add package Amazon.CDK.Lib
var privateZoneFromAttributes = PrivateHostedZone.FromPrivateHostedZoneAttributes(this, "MyPrivateZone", new PrivateHostedZoneAttributes {
ZoneName = "example.local",
HostedZoneId = "ZOJJZC49E0EPZ"
});
// Does not know zoneName
var privateZoneFromId = PrivateHostedZone.FromPrivateHostedZoneId(this, "MyPrivateZone", "ZOJJZC49E0EPZ");
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
privateZoneFromAttributes := route53.PrivateHostedZone_FromPrivateHostedZoneAttributes(this, jsii.String("MyPrivateZone"), &PrivateHostedZoneAttributes{
ZoneName: jsii.String("example.local"),
HostedZoneId: jsii.String("ZOJJZC49E0EPZ"),
})
// Does not know zoneName
privateZoneFromId := route53.PrivateHostedZone_FromPrivateHostedZoneId(this, jsii.String("MyPrivateZone"), jsii.String("ZOJJZC49E0EPZ"))
Initializer
new PrivateHostedZone(scope: Construct, id: string, props: PrivateHostedZoneProps)
PrivateHostedZone(scope: Construct, id: str, props: PrivateHostedZoneProps)
new PrivateHostedZone(Construct scope, String id, PrivateHostedZoneProps props)
new PrivateHostedZone(Construct scope, string id, PrivateHostedZoneProps props)
NewPrivateHostedZone(Scope Construct, Id *string, Props PrivateHostedZoneProps)
Construct Props
addTrailingDotoptionalbooleanadd_trailing_dotoptionalbooladdTrailingDotoptionalBooleanAddTrailingDotoptionalboolAddTrailingDotoptional*bool= true#commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string= none#queryLogsLogGroupArnoptionalstringquery_logs_log_group_arnoptionalstrqueryLogsLogGroupArnoptionalStringQueryLogsLogGroupArnoptionalstringQueryLogsLogGroupArnoptional*string= disabled#Private hosted zones must be associated with at least one VPC. You can associated additional VPCs using addVpc(vpc).
For resource record types that include a domain name, specify a fully qualified domain name.
Properties
envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironmentrequired#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
grantsHostedZoneGrantsgrantsHostedZoneGrantsgrantsHostedZoneGrantsGrantsHostedZoneGrantsGrantsHostedZoneGrantsrequired#hostedZoneArnstringhosted_zone_arnstrhostedZoneArnStringHostedZoneArnstringHostedZoneArn*stringrequired#hostedZoneNameServersmay be undefinedstring[]hosted_zone_name_serversmay be undefinedtyping.List[str]hostedZoneNameServersmay be undefinedList<String>HostedZoneNameServersmay be undefinedstring[]HostedZoneNameServersmay be undefined*[]*string#This attribute will be undefined for private hosted zones or hosted zones imported from another stack.
hostedZoneRefHostedZoneReferencehosted_zone_refHostedZoneReferencehostedZoneRefHostedZoneReferenceHostedZoneRefHostedZoneReferenceHostedZoneRefHostedZoneReferencerequired#PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringrequiredstatic#Methods
addVpc(vpc: IVpc): voiddef add_vpc(self, vpc: IVpc) -> Nonepublic void addVpc(IVpc vpc)public void AddVpc(IVpc vpc)func AddVpc(Vpc IVpc)#1 parameter
Parameters
vpcvpcvpcvpcVpc— the other VPC to add.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).
enableDnssec(options: ZoneSigningOptions): IKeySigningKeydef enable_dnssec(self, options: ZoneSigningOptions) -> IKeySigningKeypublic IKeySigningKey enableDnssec(ZoneSigningOptions options)public IKeySigningKey EnableDnssec(ZoneSigningOptions options)func EnableDnssec(Options ZoneSigningOptions) IKeySigningKey#This will create a key signing key with the given options and enable DNSSEC signing for the hosted zone.
fromHostedZoneAttributes(scope: Construct, id: string, attrs: HostedZoneAttributes): IHostedZone@staticmethod def from_hosted_zone_attributes(scope: Construct, id: str, attrs: HostedZoneAttributes) -> IHostedZonepublic static IHostedZone fromHostedZoneAttributes(Construct scope, String id, HostedZoneAttributes attrs)public static IHostedZone FromHostedZoneAttributes(Construct scope, string id, HostedZoneAttributes attrs)func FromHostedZoneAttributes(Scope Construct, Id *string, Attrs HostedZoneAttributes) IHostedZonestatic#Use when both hosted zone ID and hosted zone name are known.
3 parameters
Parameters
scopescopescopescopeScope— the parent Construct for this Construct.ididididId— the logical name of this Construct.attrsattrsattrsattrsAttrs— the HostedZoneAttributes (hosted zone ID and hosted zone name).
fromHostedZoneId(scope: Construct, id: string, hostedZoneId: string): IHostedZone@staticmethod def from_hosted_zone_id(scope: Construct, id: str, hosted_zone_id: str) -> IHostedZonepublic static IHostedZone fromHostedZoneId(Construct scope, String id, String hostedZoneId)public static IHostedZone FromHostedZoneId(Construct scope, string id, string hostedZoneId)func FromHostedZoneId(Scope Construct, Id *string, HostedZoneId *string) IHostedZonestatic#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()
3 parameters
Parameters
scopescopescopescopeScope— the parent Construct for this Construct.ididididId— the logical name of this Construct.hostedZoneIdhosted_zone_idhostedZoneIdhostedZoneIdHostedZoneId— the ID of the hosted zone to import.
fromLookup(scope: Construct, id: string, query: HostedZoneProviderProps): IHostedZone@staticmethod def from_lookup(scope: Construct, id: str, query: HostedZoneProviderProps) -> IHostedZonepublic static IHostedZone fromLookup(Construct scope, String id, HostedZoneProviderProps query)public static IHostedZone FromLookup(Construct scope, string id, HostedZoneProviderProps query)func FromLookup(Scope Construct, Id *string, Query HostedZoneProviderProps) IHostedZonestatic#Requires environment, you must specify env for the stack.
Use to easily query hosted zones.
fromPrivateHostedZoneAttributes(scope: Construct, id: string, attrs: PrivateHostedZoneAttributes): IPrivateHostedZone@staticmethod def from_private_hosted_zone_attributes(scope: Construct, id: str, attrs: PrivateHostedZoneAttributes) -> IPrivateHostedZonepublic static IPrivateHostedZone fromPrivateHostedZoneAttributes(Construct scope, String id, PrivateHostedZoneAttributes attrs)public static IPrivateHostedZone FromPrivateHostedZoneAttributes(Construct scope, string id, PrivateHostedZoneAttributes attrs)func FromPrivateHostedZoneAttributes(Scope Construct, Id *string, Attrs PrivateHostedZoneAttributes) IPrivateHostedZonestatic#Use when both hosted zone ID and hosted zone name are known.
3 parameters
Parameters
scopescopescopescopeScope— the parent Construct for this Construct.ididididId— the logical name of this Construct.attrsattrsattrsattrsAttrs— the PrivateHostedZoneAttributes (hosted zone ID and hosted zone name).
fromPrivateHostedZoneId(scope: Construct, id: string, privateHostedZoneId: string): IPrivateHostedZone@staticmethod def from_private_hosted_zone_id(scope: Construct, id: str, private_hosted_zone_id: str) -> IPrivateHostedZonepublic static IPrivateHostedZone fromPrivateHostedZoneId(Construct scope, String id, String privateHostedZoneId)public static IPrivateHostedZone FromPrivateHostedZoneId(Construct scope, string id, string privateHostedZoneId)func FromPrivateHostedZoneId(Scope Construct, Id *string, PrivateHostedZoneId *string) IPrivateHostedZonestatic#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 you cannot import a PrivateHostedZone.
3 parameters
Parameters
scopescopescopescopeScope— the parent Construct for this Construct.ididididId— the logical name of this Construct.privateHostedZoneIdprivate_hosted_zone_idprivateHostedZoneIdprivateHostedZoneIdPrivateHostedZoneId— the ID of the private hosted zone to import.
grantDelegation(grantee: IGrantable, options?: GrantDelegationOptions): Grantdef grant_delegation(self, grantee: IGrantable, options: typing.Optional[GrantDelegationOptions] = None) -> Grantpublic Grant grantDelegation(IGrantable grantee, GrantDelegationOptions options)public Grant GrantDelegation(IGrantable grantee, GrantDelegationOptions? options = null)func GrantDelegation(Grantee IGrantable, Options GrantDelegationOptions) Grant#isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.