CnameRecordProps Struct
Construction properties for a CnameRecord.
| Source | aws-route53/lib/record-set.ts |
|---|
Example
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as route53 from 'aws-cdk-lib/aws-route53';
const myDomainName = 'api.example.com';
const certificate = new acm.Certificate(this, 'cert', { domainName: myDomainName });
const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' })
const api = new appsync.GraphqlApi(this, 'api', {
name: 'myApi',
definition: appsync.Definition.fromSchema(schema),
domainName: {
certificate,
domainName: myDomainName,
},
});
// hosted zone and route53 features
declare const hostedZoneId: string;
declare const zoneName = 'example.com';
// hosted zone for adding appsync domain
const zone = route53.HostedZone.fromHostedZoneAttributes(this, `HostedZone`, {
hostedZoneId,
zoneName,
});
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
new route53.CnameRecord(this, `CnameApiRecord`, {
recordName: 'api',
zone,
domainName: api.appSyncDomainName,
});
import aws_cdk.aws_certificatemanager as acm
import aws_cdk.aws_route53 as route53
# hosted zone and route53 features
# hosted_zone_id: str
zone_name = "example.com"
my_domain_name = "api.example.com"
certificate = acm.Certificate(self, "cert", domain_name=my_domain_name)
schema = appsync.SchemaFile(file_path="mySchemaFile")
api = appsync.GraphqlApi(self, "api",
name="myApi",
definition=appsync.Definition.from_schema(schema),
domain_name=appsync.DomainOptions(
certificate=certificate,
domain_name=my_domain_name
)
)
# hosted zone for adding appsync domain
zone = route53.HostedZone.from_hosted_zone_attributes(self, "HostedZone",
hosted_zone_id=hosted_zone_id,
zone_name=zone_name
)
# create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.CnameRecord(self, "CnameApiRecord",
record_name="api",
zone=zone,
domain_name=api.app_sync_domain_name
)
import software.amazon.awscdk.services.certificatemanager.*;
import software.amazon.awscdk.services.route53.*;
// hosted zone and route53 features
String hostedZoneId;
String zoneName = "example.com";
String myDomainName = "api.example.com";
Certificate certificate = Certificate.Builder.create(this, "cert").domainName(myDomainName).build();
SchemaFile schema = SchemaFile.Builder.create().filePath("mySchemaFile").build();
GraphqlApi api = GraphqlApi.Builder.create(this, "api")
.name("myApi")
.definition(Definition.fromSchema(schema))
.domainName(DomainOptions.builder()
.certificate(certificate)
.domainName(myDomainName)
.build())
.build();
// hosted zone for adding appsync domain
IHostedZone zone = HostedZone.fromHostedZoneAttributes(this, "HostedZone", HostedZoneAttributes.builder()
.hostedZoneId(hostedZoneId)
.zoneName(zoneName)
.build());
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
CnameRecord.Builder.create(this, "CnameApiRecord")
.recordName("api")
.zone(zone)
.domainName(api.getAppSyncDomainName())
.build();
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.CertificateManager;
using Amazon.CDK.AWS.Route53;
// hosted zone and route53 features
string hostedZoneId;
var zoneName = "example.com";
var myDomainName = "api.example.com";
var certificate = new Certificate(this, "cert", new CertificateProps { DomainName = myDomainName });
var schema = new SchemaFile(new SchemaProps { FilePath = "mySchemaFile" });
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "myApi",
Definition = Definition.FromSchema(schema),
DomainName = new DomainOptions {
Certificate = certificate,
DomainName = myDomainName
}
});
// hosted zone for adding appsync domain
var zone = HostedZone.FromHostedZoneAttributes(this, "HostedZone", new HostedZoneAttributes {
HostedZoneId = hostedZoneId,
ZoneName = zoneName
});
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
new CnameRecord(this, "CnameApiRecord", new CnameRecordProps {
RecordName = "api",
Zone = zone,
DomainName = api.AppSyncDomainName
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import acm "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
// hosted zone and route53 features
var hostedZoneId string
zoneName := "example.com"
myDomainName := "api.example.com"
certificate := acm.NewCertificate(this, jsii.String("cert"), &CertificateProps{
DomainName: myDomainName,
})
schema := appsync.NewSchemaFile(&SchemaProps{
FilePath: jsii.String("mySchemaFile"),
})
api := appsync.NewGraphqlApi(this, jsii.String("api"), &GraphqlApiProps{
Name: jsii.String("myApi"),
Definition: appsync.Definition_FromSchema(schema),
DomainName: &DomainOptions{
Certificate: *Certificate,
DomainName: myDomainName,
},
})
// hosted zone for adding appsync domain
zone := route53.HostedZone_FromHostedZoneAttributes(this, jsii.String("HostedZone"), &HostedZoneAttributes{
HostedZoneId: jsii.String(HostedZoneId),
ZoneName: jsii.String(ZoneName),
})
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
// create a cname to the appsync domain. will map to something like xxxx.cloudfront.net
route53.NewCnameRecord(this, jsii.String("CnameApiRecord"), &CnameRecordProps{
RecordName: jsii.String("api"),
Zone: Zone,
DomainName: api.appSyncDomainName,
})
Properties
cidrRoutingConfigoptionalCidrRoutingConfigcidr_routing_configoptionalCidrRoutingConfigcidrRoutingConfigoptionalCidrRoutingConfigCidrRoutingConfigoptionalCidrRoutingConfigCidrRoutingConfigoptionalCidrRoutingConfig #Default: No CIDR routing configured
A LocationName with an asterisk “*” can be used to create a default CIDR record. CollectionId is still required for default record.
commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #Default: no comment
deleteExistingoptionalbooleandelete_existingoptionalbooldeleteExistingoptionalBooleanDeleteExistingoptionalboolDeleteExistingoptional*bool = false deprecated #notes
This allows you to deploy a new record set while minimizing the downtime because the new record set will be created immediately after the existing one is deleted. It also avoids "manual" actions to delete existing record sets.
N.B.: this feature is dangerous, use with caution! It can only be used safely when
deleteExistingis set totrueas soon as the resource is added to the stack. Changing an existing Record Set'sdeleteExistingproperty fromfalse -> trueafter deployment will delete the record!
failoveroptionalFailoverfailoveroptionalFailoverfailoveroptionalFailoverFailoveroptionalFailoverFailoveroptionalFailover #Default: No failover configuration
notes
To configure failover, you add the Failover element to two resource record sets. For one resource record set, you specify PRIMARY as the value for Failover; for the other resource record set, you specify SECONDARY.
You must also include the HealthCheckId element for PRIMARY configurations.
geoLocationoptionalGeoLocationgeo_locationoptionalGeoLocationgeoLocationoptionalGeoLocationGeoLocationoptionalGeoLocationGeoLocationoptionalGeoLocation #healthCheckoptionalIHealthCheckhealth_checkoptionalIHealthCheckhealthCheckoptionalIHealthCheckHealthCheckoptionalIHealthCheckHealthCheckoptionalIHealthCheck #Default: No health check configured
Route53 will return this record set in response to DNS queries only if the health check is passing.
multiValueAnsweroptionalbooleanmulti_value_answeroptionalboolmultiValueAnsweroptionalBooleanMultiValueAnsweroptionalboolMultiValueAnsweroptional*bool = false #recordNameoptionalstringrecord_nameoptionalstrrecordNameoptionalStringRecordNameoptionalstringRecordNameoptional*string #Default: zone root
For example, if you want to create a record for acme.example.com, specify "acme".
You can also specify the fully qualified domain name which terminates with a ".". For example, "acme.example.com.".
regionoptionalstringregionoptionalstrregionoptionalStringRegionoptionalstringRegionoptional*string #Default: Do not set latency based routing
notes
The resource typically is an AWS resource, such as an EC2 instance or an ELB load balancer, and is referred to by an IP address or a DNS domain name, depending on the record type.
When Amazon Route 53 receives a DNS query for a domain name and type for which you have created latency resource record sets, Route 53 selects the latency resource record set that has the lowest latency between the end user and the associated Amazon EC2 Region. Route 53 then returns the value that is associated with the selected resource record set.
setIdentifieroptionalstringset_identifieroptionalstrsetIdentifieroptionalStringSetIdentifieroptionalstringSetIdentifieroptional*string #Default: Auto generated string
It can only be set when either weight or geoLocation is defined.
This parameter must be between 1 and 128 characters in length.
ttloptionalDurationttloptionalDurationttloptionalDurationTtloptionalDurationTtloptionalDuration = Duration.minutes(30) #weightoptionalnumberweightoptionalint | floatweightoptionalNumberWeightoptionaldoubleWeightoptional*float64 #Default: Do not set weighted routing
notes
Route 53 calculates the sum of the weights for the resource record sets that have the same combination of DNS name and type. Route 53 then responds to queries based on the ratio of a resource's weight to the total.
This value can be a number between 0 and 255.