@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:46.568Z") public class CloudFrontWebDistribution extends Resource implements IDistribution
CloudFront fronts user provided content and caches it at edge locations across the world.
Here's how you can use this construct:
Bucket sourceBucket = new Bucket(this, "Bucket"); CloudFrontWebDistribution distribution = CloudFrontWebDistribution.Builder.create(this, "MyDistribution") .originConfigs(List.of(SourceConfiguration.builder() .s3OriginSource(S3OriginConfig.builder() .s3BucketSource(sourceBucket) .build()) .behaviors(List.of(Behavior.builder().isDefaultBehavior(true).build())) .build())) .build();
This will create a CloudFront distribution that uses your S3Bucket as it's origin.
You can customize the distribution using additional properties from the CloudFrontWebDistributionProps interface.
Example:
Bucket sourceBucket; ViewerCertificate viewerCertificate = ViewerCertificate.fromIamCertificate("MYIAMROLEIDENTIFIER", ViewerCertificateOptions.builder() .aliases(List.of("MYALIAS")) .build()); CloudFrontWebDistribution.Builder.create(this, "MyCfWebDistribution") .originConfigs(List.of(SourceConfiguration.builder() .s3OriginSource(S3OriginConfig.builder() .s3BucketSource(sourceBucket) .build()) .behaviors(List.of(Behavior.builder().isDefaultBehavior(true).build())) .build())) .viewerCertificate(viewerCertificate) .build();
Modifier and Type | Class and Description |
---|---|
static class |
CloudFrontWebDistribution.Builder
A fluent builder for
CloudFrontWebDistribution . |
IDistribution.Jsii$Default, IDistribution.Jsii$Proxy
Modifier | Constructor and Description |
---|---|
protected |
CloudFrontWebDistribution(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CloudFrontWebDistribution(software.amazon.jsii.JsiiObjectRef objRef) |
|
CloudFrontWebDistribution(software.constructs.Construct scope,
java.lang.String id,
CloudFrontWebDistributionProps props) |
Modifier and Type | Method and Description |
---|---|
static IDistribution |
fromDistributionAttributes(software.constructs.Construct scope,
java.lang.String id,
CloudFrontWebDistributionAttributes attrs)
Creates a construct that represents an external (imported) distribution.
|
java.lang.String |
getDistributionDomainName()
The domain name created by CloudFront for this distribution.
|
java.lang.String |
getDistributionId()
The distribution ID for this distribution.
|
java.lang.String |
getDomainName()
Deprecated.
- Use `distributionDomainName` instead.
|
IBucket |
getLoggingBucket()
The logging bucket for this CloudFront distribution.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyRemovalPolicy, getEnv, getStack
getNode
protected CloudFrontWebDistribution(software.amazon.jsii.JsiiObjectRef objRef)
protected CloudFrontWebDistribution(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CloudFrontWebDistribution(software.constructs.Construct scope, java.lang.String id, CloudFrontWebDistributionProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public static IDistribution fromDistributionAttributes(software.constructs.Construct scope, java.lang.String id, CloudFrontWebDistributionAttributes attrs)
scope
- This parameter is required.id
- This parameter is required.attrs
- This parameter is required.public java.lang.String getDistributionDomainName()
If you are using aliases for your distribution, this is the domainName your DNS records should point to. (In Route53, you could create an ALIAS record to this value, for example.)
getDistributionDomainName
in interface IDistribution
public java.lang.String getDistributionId()
getDistributionId
in interface IDistribution
@Deprecated public java.lang.String getDomainName()
If you are using aliases for your distribution, this is the domainName your DNS records should point to. (In Route53, you could create an ALIAS record to this value, for example.)
getDomainName
in interface IDistribution
public IBucket getLoggingBucket()
If logging is not enabled for this distribution - this property will be undefined.