aws / aws/aws-cdk

Route53: Create PrivateHostedZone with just VpcId

Open
#24,736 3 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-route53 effort/medium feature-request p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the feature

Similar to Cloudformation, enable creation of HostedZones with just VpcId and VpcRegion
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-vpcs
- https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-route53-hostedzone-vpc.html

### Use Case

Creating a PrivateHostedZone [requires an IVpc today](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-route53.PrivateHostedZone.html). If the PrivateHostedZone is in a different stack, the VPC object creation requires a [Vpc.fromLookup](https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-ec2.Vpc.html#static-fromwbrlookupscope-id-options) call that creates a dependency between stack creation.

Eg. For a new service creation in a region:
1. VPC creation in Stack1
2. Run build in stack2 for cdk context to be populated
3. Create PHZ Stack2

### Proposed Solution

Enable PrivateHostedZone creation with just VpcId and region similar to the Cloudformation template https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-route53-hostedzone.html#cfn-route53-hostedzone-vpcs

This would help remove the dependency by just exporting the VpcId from the VPC stack and referring to it in the PrivateHostedZone stack.

Eg. For a new service creation in a region:
1. VPC creation in Stack1
3. Create PHZ Stack2

### Other Information

_No response_

### Acknowledgements

- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change

### CDK version used

1.197.0

### Environment details (OS name and version, etc.)

MacOs

Contributor guide

Open the contributing guide

Research direction

Start at the PrivateHostedZone API and its current requirement for an IVpc, then compare it with the CloudFormation HostedZone VPC and VpcRegion properties and the Vpc.fromLookup workflow described here. Done means a private hosted zone can accept only a VpcId and region while preserving the existing use case and removing the cross-stack lookup dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.