awsroute53targets

package
v2.112.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 15 Imported by: 12

README

Route53 Alias Record Targets for the CDK Route53 Library

This library contains Route53 Alias Record targets for:

  • API Gateway custom domains

    import apigw "github.com/aws/aws-cdk-go/awscdk"
    
    var zone hostedZone
    var restApi lambdaRestApi
    
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewApiGateway(restApi)),
    })
    
  • API Gateway V2 custom domains

    import apigwv2 "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha"
    
    var zone hostedZone
    var domainName domainName
    
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewApiGatewayv2DomainProperties(domainName.RegionalDomainName, domainName.RegionalHostedZoneId)),
    })
    
  • CloudFront distributions

    import cloudfront "github.com/aws/aws-cdk-go/awscdk"
    
    var zone hostedZone
    var distribution cloudFrontWebDistribution
    
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewCloudFrontTarget(distribution)),
    })
    
  • ELBv2 load balancers

    import elbv2 "github.com/aws/aws-cdk-go/awscdk"
    
    var zone hostedZone
    var lb applicationLoadBalancer
    
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewLoadBalancerTarget(lb)),
    })
    
  • Classic load balancers

    import elb "github.com/aws/aws-cdk-go/awscdk"
    
    var zone hostedZone
    var lb loadBalancer
    
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewClassicLoadBalancerTarget(lb)),
    })
    

Important: Based on AWS documentation, all alias record in Route 53 that points to a Elastic Load Balancer will always include dualstack for the DNSName to resolve IPv4/IPv6 addresses (without dualstack IPv6 will not resolve).

For example, if the Amazon-provided DNS for the load balancer is ALB-xxxxxxx.us-west-2.elb.amazonaws.com, CDK will create alias target in Route 53 will be dualstack.ALB-xxxxxxx.us-west-2.elb.amazonaws.com.

  • GlobalAccelerator

    import globalaccelerator "github.com/aws/aws-cdk-go/awscdk"
    
    var zone hostedZone
    var accelerator accelerator
    
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewGlobalAcceleratorTarget(accelerator)),
    })
    

Important: If you use GlobalAcceleratorDomainTarget, passing a string rather than an instance of IAccelerator, ensure that the string is a valid domain name of an existing Global Accelerator instance. See the documentation on DNS addressing with Global Accelerator for more info.

  • InterfaceVpcEndpoints

Important: Based on the CFN docs for VPCEndpoints - see here - the attributes returned for DnsEntries in CloudFormation is a combination of the hosted zone ID and the DNS name. The entries are ordered as follows: regional public DNS, zonal public DNS, private DNS, and wildcard DNS. This order is not enforced for AWS Marketplace services, and therefore this CDK construct is ONLY guaranteed to work with non-marketplace services.

import ec2 "github.com/aws/aws-cdk-go/awscdk"

var zone hostedZone
var interfaceVpcEndpoint interfaceVpcEndpoint


route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewInterfaceVpcEndpointTarget(interfaceVpcEndpoint)),
})
  • S3 Bucket Website:

Important: The Bucket name must strictly match the full DNS name. See the Developer Guide for more info.

import s3 "github.com/aws/aws-cdk-go/awscdk"


recordName := "www"
domainName := "example.com"

bucketWebsite := s3.NewBucket(this, jsii.String("BucketWebsite"), &BucketProps{
	BucketName: []*string{
		recordName,
		domainName,
	}.join(jsii.String(".")),
	 // www.example.com
	PublicReadAccess: jsii.Boolean(true),
	WebsiteIndexDocument: jsii.String("index.html"),
})

zone := route53.HostedZone_FromLookup(this, jsii.String("Zone"), &HostedZoneProviderProps{
	DomainName: jsii.String(DomainName),
}) // example.com

 // example.com
route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	RecordName: jsii.String(RecordName),
	 // www
	Target: route53.RecordTarget_FromAlias(targets.NewBucketWebsiteTarget(bucketWebsite)),
})
  • User pool domain

    import cognito "github.com/aws/aws-cdk-go/awscdk"
    
    var zone hostedZone
    var domain userPoolDomain
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewUserPoolDomainTarget(domain)),
    })
    
  • Route 53 record

    var zone hostedZone
    var record aRecord
    
    route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
    	Zone: Zone,
    	Target: route53.RecordTarget_FromAlias(targets.NewRoute53RecordTarget(record)),
    })
    
  • Elastic Beanstalk environment:

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

var zone hostedZone
var ebsEnvironmentUrl string


route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl)),
})

See the documentation of aws-cdk-lib/aws-route53 for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloudFrontTarget_CLOUDFRONT_ZONE_ID

func CloudFrontTarget_CLOUDFRONT_ZONE_ID() *string

func CloudFrontTarget_GetHostedZoneId

func CloudFrontTarget_GetHostedZoneId(scope constructs.IConstruct) *string

Get the hosted zone id for the current scope.

func GlobalAcceleratorDomainTarget_GLOBAL_ACCELERATOR_ZONE_ID

func GlobalAcceleratorDomainTarget_GLOBAL_ACCELERATOR_ZONE_ID() *string

func GlobalAcceleratorTarget_GLOBAL_ACCELERATOR_ZONE_ID

func GlobalAcceleratorTarget_GLOBAL_ACCELERATOR_ZONE_ID() *string

func NewApiGatewayDomain_Override

func NewApiGatewayDomain_Override(a ApiGatewayDomain, domainName awsapigateway.IDomainName)

func NewApiGateway_Override

func NewApiGateway_Override(a ApiGateway, api awsapigateway.RestApiBase)

func NewApiGatewayv2DomainProperties_Override

func NewApiGatewayv2DomainProperties_Override(a ApiGatewayv2DomainProperties, regionalDomainName *string, regionalHostedZoneId *string)

func NewBucketWebsiteTarget_Override

func NewBucketWebsiteTarget_Override(b BucketWebsiteTarget, bucket awss3.IBucket)

func NewClassicLoadBalancerTarget_Override

func NewClassicLoadBalancerTarget_Override(c ClassicLoadBalancerTarget, loadBalancer awselasticloadbalancing.LoadBalancer)

func NewCloudFrontTarget_Override

func NewCloudFrontTarget_Override(c CloudFrontTarget, distribution awscloudfront.IDistribution)

func NewElasticBeanstalkEnvironmentEndpointTarget_Override

func NewElasticBeanstalkEnvironmentEndpointTarget_Override(e ElasticBeanstalkEnvironmentEndpointTarget, environmentEndpoint *string)

func NewGlobalAcceleratorDomainTarget_Override

func NewGlobalAcceleratorDomainTarget_Override(g GlobalAcceleratorDomainTarget, acceleratorDomainName *string)

Create an Alias Target for a Global Accelerator domain name.

func NewGlobalAcceleratorTarget_Override

func NewGlobalAcceleratorTarget_Override(g GlobalAcceleratorTarget, accelerator awsglobalaccelerator.IAccelerator)

Create an Alias Target for a Global Accelerator instance.

func NewInterfaceVpcEndpointTarget_Override

func NewInterfaceVpcEndpointTarget_Override(i InterfaceVpcEndpointTarget, vpcEndpoint awsec2.InterfaceVpcEndpoint)

func NewLoadBalancerTarget_Override

func NewLoadBalancerTarget_Override(l LoadBalancerTarget, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2)

func NewRoute53RecordTarget_Override

func NewRoute53RecordTarget_Override(r Route53RecordTarget, record awsroute53.IRecordSet)

func NewUserPoolDomainTarget_Override

func NewUserPoolDomainTarget_Override(u UserPoolDomainTarget, domain awscognito.UserPoolDomain)

Types

type ApiGateway

type ApiGateway interface {
	ApiGatewayDomain
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Defines an API Gateway REST API as the alias target. Requires that the domain name will be defined through `RestApiProps.domainName`.

You can direct the alias to any `apigateway.DomainName` resource through the `ApiGatewayDomain` class.

Example:

import "github.com/aws/aws-cdk-go/awscdk"
import targets "github.com/aws/aws-cdk-go/awscdk"

var api restApi
var hostedZoneForExampleCom interface{}

route53.NewARecord(this, jsii.String("CustomDomainAliasRecord"), &ARecordProps{
	Zone: hostedZoneForExampleCom,
	Target: route53.RecordTarget_FromAlias(targets.NewApiGateway(api)),
})

func NewApiGateway

func NewApiGateway(api awsapigateway.RestApiBase) ApiGateway

type ApiGatewayDomain

type ApiGatewayDomain interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Defines an API Gateway domain name as the alias target.

Use the `ApiGateway` class if you wish to map the alias to an REST API with a domain name defined through the `RestApiProps.domainName` prop.

Example:

var hostedZoneForExampleCom interface{}
var domainName domainName

import "github.com/aws/aws-cdk-go/awscdk"
import targets "github.com/aws/aws-cdk-go/awscdk"

route53.NewARecord(this, jsii.String("CustomDomainAliasRecord"), &ARecordProps{
	Zone: hostedZoneForExampleCom,
	Target: route53.RecordTarget_FromAlias(targets.NewApiGatewayDomain(domainName)),
})

func NewApiGatewayDomain

func NewApiGatewayDomain(domainName awsapigateway.IDomainName) ApiGatewayDomain

type ApiGatewayv2DomainProperties

type ApiGatewayv2DomainProperties interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Defines an API Gateway V2 domain name as the alias target.

Example:

import apigwv2 "github.com/aws/aws-cdk-go/awscdkapigatewayv2alpha"

var zone hostedZone
var domainName domainName

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewApiGatewayv2DomainProperties(domainName.RegionalDomainName, domainName.RegionalHostedZoneId)),
})

func NewApiGatewayv2DomainProperties

func NewApiGatewayv2DomainProperties(regionalDomainName *string, regionalHostedZoneId *string) ApiGatewayv2DomainProperties

type BucketWebsiteTarget

type BucketWebsiteTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use a S3 as an alias record target.

Example:

import s3 "github.com/aws/aws-cdk-go/awscdk"

recordName := "www"
domainName := "example.com"

bucketWebsite := s3.NewBucket(this, jsii.String("BucketWebsite"), &BucketProps{
	BucketName: []*string{
		recordName,
		domainName,
	}.join(jsii.String(".")),
	 // www.example.com
	PublicReadAccess: jsii.Boolean(true),
	WebsiteIndexDocument: jsii.String("index.html"),
})

zone := route53.HostedZone_FromLookup(this, jsii.String("Zone"), &HostedZoneProviderProps{
	DomainName: jsii.String(DomainName),
}) // example.com

 // example.com
route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	RecordName: jsii.String(RecordName),
	 // www
	Target: route53.RecordTarget_FromAlias(targets.NewBucketWebsiteTarget(bucketWebsite)),
})

func NewBucketWebsiteTarget

func NewBucketWebsiteTarget(bucket awss3.IBucket) BucketWebsiteTarget

type ClassicLoadBalancerTarget

type ClassicLoadBalancerTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use a classic ELB as an alias record target.

Example:

import elb "github.com/aws/aws-cdk-go/awscdk"

var zone hostedZone
var lb loadBalancer

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewClassicLoadBalancerTarget(lb)),
})

type CloudFrontTarget

type CloudFrontTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use a CloudFront Distribution as an alias record target.

Example:

import cloudfront "github.com/aws/aws-cdk-go/awscdk"

var myZone hostedZone
var distribution cloudFrontWebDistribution

route53.NewAaaaRecord(this, jsii.String("Alias"), &AaaaRecordProps{
	Zone: myZone,
	Target: route53.RecordTarget_FromAlias(targets.NewCloudFrontTarget(distribution)),
})

func NewCloudFrontTarget

func NewCloudFrontTarget(distribution awscloudfront.IDistribution) CloudFrontTarget

type ElasticBeanstalkEnvironmentEndpointTarget

type ElasticBeanstalkEnvironmentEndpointTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

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:

var zone hostedZone
var ebsEnvironmentUrl string

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewElasticBeanstalkEnvironmentEndpointTarget(ebsEnvironmentUrl)),
})

func NewElasticBeanstalkEnvironmentEndpointTarget

func NewElasticBeanstalkEnvironmentEndpointTarget(environmentEndpoint *string) ElasticBeanstalkEnvironmentEndpointTarget

type GlobalAcceleratorDomainTarget

type GlobalAcceleratorDomainTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use a Global Accelerator domain name as an alias record target.

Example:

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

globalAcceleratorDomainTarget := awscdk.Aws_route53_targets.NewGlobalAcceleratorDomainTarget(jsii.String("acceleratorDomainName"))

func NewGlobalAcceleratorDomainTarget

func NewGlobalAcceleratorDomainTarget(acceleratorDomainName *string) GlobalAcceleratorDomainTarget

Create an Alias Target for a Global Accelerator domain name.

type GlobalAcceleratorTarget

type GlobalAcceleratorTarget interface {
	GlobalAcceleratorDomainTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use a Global Accelerator instance domain name as an alias record target.

Example:

import globalaccelerator "github.com/aws/aws-cdk-go/awscdk"

var zone hostedZone
var accelerator accelerator

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewGlobalAcceleratorTarget(accelerator)),
})

func NewGlobalAcceleratorTarget

func NewGlobalAcceleratorTarget(accelerator awsglobalaccelerator.IAccelerator) GlobalAcceleratorTarget

Create an Alias Target for a Global Accelerator instance.

type InterfaceVpcEndpointTarget

type InterfaceVpcEndpointTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Set an InterfaceVpcEndpoint as a target for an ARecord.

Example:

import ec2 "github.com/aws/aws-cdk-go/awscdk"

var zone hostedZone
var interfaceVpcEndpoint interfaceVpcEndpoint

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewInterfaceVpcEndpointTarget(interfaceVpcEndpoint)),
})

func NewInterfaceVpcEndpointTarget

func NewInterfaceVpcEndpointTarget(vpcEndpoint awsec2.InterfaceVpcEndpoint) InterfaceVpcEndpointTarget

type LoadBalancerTarget

type LoadBalancerTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use an ELBv2 as an alias record target.

Example:

import elbv2 "github.com/aws/aws-cdk-go/awscdk"

var zone hostedZone
var lb applicationLoadBalancer

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewLoadBalancerTarget(lb)),
})

type Route53RecordTarget

type Route53RecordTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use another Route 53 record as an alias record target.

Example:

var zone hostedZone
var record aRecord

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewRoute53RecordTarget(record)),
})

func NewRoute53RecordTarget

func NewRoute53RecordTarget(record awsroute53.IRecordSet) Route53RecordTarget

type UserPoolDomainTarget

type UserPoolDomainTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	Bind(_record awsroute53.IRecordSet, _zone awsroute53.IHostedZone) *awsroute53.AliasRecordTargetConfig
}

Use a user pool domain as an alias record target.

Example:

import cognito "github.com/aws/aws-cdk-go/awscdk"

var zone hostedZone
var domain userPoolDomain

route53.NewARecord(this, jsii.String("AliasRecord"), &ARecordProps{
	Zone: Zone,
	Target: route53.RecordTarget_FromAlias(targets.NewUserPoolDomainTarget(domain)),
})

func NewUserPoolDomainTarget

func NewUserPoolDomainTarget(domain awscognito.UserPoolDomain) UserPoolDomainTarget

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL