Skip to content
v2.274.0

ElasticBeanstalkEnvironmentEndpointTarget Class ​

Use an Elastic Beanstalk environment URL as an alias record target. E.g. mysampleenvironment.xyz.us-east-1.elasticbeanstalk.com or mycustomcnameprefix.us-east-1.elasticbeanstalk.com.

Only supports Elastic Beanstalk environments created after 2016 that have a regional endpoint.

Example ​

ts
import { RegionInfo } from 'aws-cdk-lib/region-info';

declare const zone: route53.HostedZone;
declare const ebsEnvironmentUrl: string;

new route53.ARecord(this, 'AliasRecord', {
  zone,
  target: route53.RecordTarget.fromAlias(
    new targets.ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl, {
      hostedZoneId: RegionInfo.get('us-east-1').ebsEnvEndpointHostedZoneId,
    }),
  ),
});
python
from aws_cdk.region_info import RegionInfo

# zone: route53.HostedZone
# ebs_environment_url: str


route53.ARecord(self, "AliasRecord",
    zone=zone,
    target=route53.RecordTarget.from_alias(
        targets.ElasticBeanstalkEnvironmentEndpointTarget(ebs_environment_url, {
            "hosted_zone_id": RegionInfo.get("us-east-1").ebs_env_endpoint_hosted_zone_id
        }))
)
java
import software.amazon.awscdk.regioninfo.RegionInfo;

HostedZone zone;
String ebsEnvironmentUrl;


ARecord.Builder.create(this, "AliasRecord")
        .zone(zone)
        .target(RecordTarget.fromAlias(
        new ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl, Map.of(
                "hostedZoneId", RegionInfo.get("us-east-1").getEbsEnvEndpointHostedZoneId()))))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.RegionInfo;

HostedZone zone;
string ebsEnvironmentUrl;


new ARecord(this, "AliasRecord", new ARecordProps {
    Zone = zone,
    Target = RecordTarget.FromAlias(
    new ElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl, new Dictionary<string, string?> {
        { "hostedZoneId", RegionInfo.Get("us-east-1").EbsEnvEndpointHostedZoneId }
    }))
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"

var zone HostedZone
var ebsEnvironmentUrl string


route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(
	targets.NewElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl, map[string]*string{
		"hostedZoneId": awscdk.RegionInfo_get(jsii.String("us-east-1")).ebsEnvEndpointHostedZoneId,
	})),
})

Initializer ​

ts
new ElasticBeanstalkEnvironmentEndpointTarget(environmentEndpoint: string, props?: IAliasRecordTargetProps)
python
ElasticBeanstalkEnvironmentEndpointTarget(environment_endpoint: str, props: typing.Optional[IAliasRecordTargetProps] = None)
java
new ElasticBeanstalkEnvironmentEndpointTarget(String environmentEndpoint, IAliasRecordTargetProps props)
csharp
new ElasticBeanstalkEnvironmentEndpointTarget(string environmentEndpoint, IAliasRecordTargetProps? props = null)
go
NewElasticBeanstalkEnvironmentEndpointTarget(EnvironmentEndpoint *string, Props IAliasRecordTargetProps)

Methods ​

bind(record: IRecordSet, _zone?: IHostedZone): AliasRecordTargetConfigdef bind(self, record: IRecordSet, _zone: typing.Optional[IHostedZone] = None) -> AliasRecordTargetConfigpublic AliasRecordTargetConfig bind(IRecordSet record, IHostedZone _zone)public AliasRecordTargetConfig Bind(IRecordSet record, IHostedZone? _zone = null)func Bind(Record IRecordSet, _zone IHostedZone) AliasRecordTargetConfig#
Return hosted zone ID and DNS name, usable for Route53 alias targets.