awsroute53targets

package
v1.181.1-devpreview Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

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/awscdk"
    
    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/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 awscdk.IConstruct) *string

Get the hosted zone id for the current scope. Experimental.

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)

Experimental.

func NewApiGateway_Override

func NewApiGateway_Override(a ApiGateway, api awsapigateway.RestApiBase)

Experimental.

func NewApiGatewayv2DomainProperties_Override

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

Experimental.

func NewBucketWebsiteTarget_Override

func NewBucketWebsiteTarget_Override(b BucketWebsiteTarget, bucket awss3.IBucket)

Experimental.

func NewClassicLoadBalancerTarget_Override

func NewClassicLoadBalancerTarget_Override(c ClassicLoadBalancerTarget, loadBalancer awselasticloadbalancing.LoadBalancer)

Experimental.

func NewCloudFrontTarget_Override

func NewCloudFrontTarget_Override(c CloudFrontTarget, distribution awscloudfront.IDistribution)

Experimental.

func NewElasticBeanstalkEnvironmentEndpointTarget_Override

func NewElasticBeanstalkEnvironmentEndpointTarget_Override(e ElasticBeanstalkEnvironmentEndpointTarget, environmentEndpoint *string)

Experimental.

func NewGlobalAcceleratorDomainTarget_Override

func NewGlobalAcceleratorDomainTarget_Override(g GlobalAcceleratorDomainTarget, acceleratorDomainName *string)

Create an Alias Target for a Global Accelerator domain name. Experimental.

func NewGlobalAcceleratorTarget_Override

func NewGlobalAcceleratorTarget_Override(g GlobalAcceleratorTarget, accelerator awsglobalaccelerator.IAccelerator)

Create an Alias Target for a Global Accelerator instance. Experimental.

func NewInterfaceVpcEndpointTarget_Override

func NewInterfaceVpcEndpointTarget_Override(i InterfaceVpcEndpointTarget, vpcEndpoint awsec2.IInterfaceVpcEndpoint)

Experimental.

func NewLoadBalancerTarget_Override

func NewLoadBalancerTarget_Override(l LoadBalancerTarget, loadBalancer awselasticloadbalancingv2.ILoadBalancerV2)

Experimental.

func NewRoute53RecordTarget_Override

func NewRoute53RecordTarget_Override(r Route53RecordTarget, record awsroute53.IRecordSet)

Experimental.

func NewUserPoolDomainTarget_Override

func NewUserPoolDomainTarget_Override(u UserPoolDomainTarget, domain awscognito.UserPoolDomain)

Experimental.

Types

type ApiGateway

type ApiGateway interface {
	ApiGatewayDomain
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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 route53 "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)),
})

Experimental.

func NewApiGateway

func NewApiGateway(api awsapigateway.RestApiBase) ApiGateway

Experimental.

type ApiGatewayDomain

type ApiGatewayDomain interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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 route53 "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)),
})

Experimental.

func NewApiGatewayDomain

func NewApiGatewayDomain(domainName awsapigateway.IDomainName) ApiGatewayDomain

Experimental.

type ApiGatewayv2DomainProperties

type ApiGatewayv2DomainProperties interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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/awscdk"

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)),
})

Experimental.

func NewApiGatewayv2DomainProperties

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

Experimental.

type BucketWebsiteTarget

type BucketWebsiteTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewBucketWebsiteTarget

func NewBucketWebsiteTarget(bucket awss3.IBucket) BucketWebsiteTarget

Experimental.

type ClassicLoadBalancerTarget

type ClassicLoadBalancerTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewClassicLoadBalancerTarget

func NewClassicLoadBalancerTarget(loadBalancer awselasticloadbalancing.LoadBalancer) ClassicLoadBalancerTarget

Experimental.

type CloudFrontTarget

type CloudFrontTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewCloudFrontTarget

func NewCloudFrontTarget(distribution awscloudfront.IDistribution) CloudFrontTarget

Experimental.

type ElasticBeanstalkEnvironmentEndpointTarget

type ElasticBeanstalkEnvironmentEndpointTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewElasticBeanstalkEnvironmentEndpointTarget

func NewElasticBeanstalkEnvironmentEndpointTarget(environmentEndpoint *string) ElasticBeanstalkEnvironmentEndpointTarget

Experimental.

type GlobalAcceleratorDomainTarget

type GlobalAcceleratorDomainTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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"))

Experimental.

func NewGlobalAcceleratorDomainTarget

func NewGlobalAcceleratorDomainTarget(acceleratorDomainName *string) GlobalAcceleratorDomainTarget

Create an Alias Target for a Global Accelerator domain name. Experimental.

type GlobalAcceleratorTarget

type GlobalAcceleratorTarget interface {
	GlobalAcceleratorDomainTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewGlobalAcceleratorTarget

func NewGlobalAcceleratorTarget(accelerator awsglobalaccelerator.IAccelerator) GlobalAcceleratorTarget

Create an Alias Target for a Global Accelerator instance. Experimental.

type InterfaceVpcEndpointTarget

type InterfaceVpcEndpointTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewInterfaceVpcEndpointTarget

func NewInterfaceVpcEndpointTarget(vpcEndpoint awsec2.IInterfaceVpcEndpoint) InterfaceVpcEndpointTarget

Experimental.

type LoadBalancerTarget

type LoadBalancerTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewLoadBalancerTarget

func NewLoadBalancerTarget(loadBalancer awselasticloadbalancingv2.ILoadBalancerV2) LoadBalancerTarget

Experimental.

type Route53RecordTarget

type Route53RecordTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewRoute53RecordTarget

func NewRoute53RecordTarget(record awsroute53.IRecordSet) Route53RecordTarget

Experimental.

type UserPoolDomainTarget

type UserPoolDomainTarget interface {
	awsroute53.IAliasRecordTarget
	// Return hosted zone ID and DNS name, usable for Route53 alias targets.
	// Experimental.
	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)),
})

Experimental.

func NewUserPoolDomainTarget

func NewUserPoolDomainTarget(domain awscognito.UserPoolDomain) UserPoolDomainTarget

Experimental.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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