class BucketWebsiteTarget
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Route53.Targets.BucketWebsiteTarget |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsroute53targets#BucketWebsiteTarget |
Java | software.amazon.awscdk.services.route53.targets.BucketWebsiteTarget |
Python | aws_cdk.aws_route53_targets.BucketWebsiteTarget |
TypeScript (source) | aws-cdk-lib » aws_route53_targets » BucketWebsiteTarget |
Implements
IAlias
Use a S3 as an alias record target.
Example
import * as s3 from 'aws-cdk-lib/aws-s3';
const recordName = 'www';
const domainName = 'example.com';
const bucketWebsite = new s3.Bucket(this, 'BucketWebsite', {
bucketName: [recordName, domainName].join('.'), // www.example.com
publicReadAccess: true,
websiteIndexDocument: 'index.html',
});
const zone = route53.HostedZone.fromLookup(this, 'Zone', {domainName}); // example.com
new route53.ARecord(this, 'AliasRecord', {
zone,
recordName, // www
target: route53.RecordTarget.fromAlias(new targets.BucketWebsiteTarget(bucketWebsite)),
});
Initializer
new BucketWebsiteTarget(bucket: IBucket)
Parameters
- bucket
IBucket
Methods
Name | Description |
---|---|
bind(_record, _zone?) | Return hosted zone ID and DNS name, usable for Route53 alias targets. |
bind(_record, _zone?)
public bind(_record: IRecordSet, _zone?: IHostedZone): AliasRecordTargetConfig
Parameters
- _record
IRecord
Set - _zone
IHosted
Zone
Returns
Return hosted zone ID and DNS name, usable for Route53 alias targets.