aws / aws/aws-cdk

region-info: add hosted zone ids for load balancer instances

Open
#34,664 1 comment 0 reactions 0 assignees View on GitHub
@aws-cdk/region-info feature-request p2
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
1d 19h
Merged PRs (30d)
71

Description

### Describe the feature

Add regional hosted zone ids for application load balancer and network load balancer under the module "aws-cdk-lib/region-info"

### Use Case

When you instantiate a Beanstalk L2 construct, attrEndpointUrl correctly returns the load balancer’s DNS name for load-balanced, autoscaling environments (and the instance’s IP for single-instance ones). However, ElasticBeanstalkEnvironmentEndpointTarget do not evaluate hostedZoneId based on the url (of course it's on synth stage), nor there's any option to indicate whether beanstalk environment is a load-balanced or a single instance.

I got frustrated when I was setting alias record on the beanstalk instance I made with L2 construct. The hosted zone id is set to beanstalk endpoint hosted zone id as a default when using ElasticBeanstalkEnvironmentEndpointTarget under "aws-cdk-lib/aws-route53-targets", which essentially causes error when deploying beanstalk environment with the load balancer and there's no documentation about it.

Considering how LoadBalancerTarget accepts L3 load balancer construct while beanstalk instance L2 construct would not give any informations about generated load balancer, and I cannot use fromLookUp method with url to identify load balancer, I don't think it is very ideal approach to use load balancer target when using aws-cdk to create beanstalk environment.

I ended up deploying alias record like:
` new ElasticBeanstalkEnvironmentEndpointTarget(
beanstalkInstance.attrEndpointUrl,
{
hostedZoneId: ELB_REGIONAL_HOSTED_ZONE_IDS[this.region],
evaluateTargetHealth: true,
}
)`

It worked but I believe these hosted zone ids should be retrieved directly from RegionInfo module.

### Proposed Solution

The RegionInfo under aws-cdk-lib/region-info is to obtain region specific information, and I found ebsEnvEndpointHostedZoneId(), which returns hosted zone id for beanstalk instance (https://docs.aws.amazon.com/general/latest/gr/elasticbeanstalk.html). However, it is hosted zone for single instance, and I believe there must be another getter method to retrieve hosted zone id for ALB / NLB (https://docs.aws.amazon.com/general/latest/gr/elb.html).

### Other Information

_No response_

### Acknowledgements

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

### AWS CDK Library version (aws-cdk-lib)

2.198.0

### AWS CDK CLI version

2.1016.1

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

Windows 10

Contributor guide

Open the contributing guide

Research direction

Start in the aws-cdk-lib/region-info module by reading the existing ebsEnvEndpointHostedZoneId() implementation and its regional data. Compare the required ALB and NLB hosted zone IDs with the AWS ELB regional documentation. Done means RegionInfo exposes the requested regional values for both load balancer types and the associated coverage is verified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.