@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-11T17:58:48.790Z") @Stability(value=Stable) 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 s3BucketSource = new Bucket(this, "Bucket");
CloudFrontWebDistribution distribution = CloudFrontWebDistribution.Builder.create(this, "AnAmazingWebsiteProbably")
.originConfigs(List.of(SourceConfiguration.builder()
.s3OriginSource(S3OriginConfig.builder().s3BucketSource(s3BucketSource).build())
.behaviors(List.of(Behavior.builder().isDefaultBehavior(true).build()))
.build()))
.viewerCertificate(ViewerCertificate.fromCloudFrontDefaultCertificate("www.example.com"))
.build();
| Modifier and Type | Class and Description |
|---|---|
static class |
CloudFrontWebDistribution.Builder
A fluent builder for
CloudFrontWebDistribution. |
software.amazon.jsii.JsiiObject.InitializationModeIDistribution.Jsii$Default, IDistribution.Jsii$Proxy| Modifier | Constructor and Description |
|---|---|
|
CloudFrontWebDistribution(software.constructs.Construct scope,
String id,
CloudFrontWebDistributionProps props) |
protected |
CloudFrontWebDistribution(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CloudFrontWebDistribution(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
static IDistribution |
fromDistributionAttributes(software.constructs.Construct scope,
String id,
CloudFrontWebDistributionAttributes attrs)
Creates a construct that represents an external (imported) distribution.
|
String |
getDistributionDomainName()
The domain name created by CloudFront for this distribution.
|
String |
getDistributionId()
The distribution ID for this distribution.
|
String |
getDomainName()
Deprecated.
- Use `distributionDomainName` instead.
|
IBucket |
getLoggingBucket()
The logging bucket for this CloudFront distribution.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResourcegetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validatejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackgetNodeprotected CloudFrontWebDistribution(software.amazon.jsii.JsiiObjectRef objRef)
protected CloudFrontWebDistribution(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public CloudFrontWebDistribution(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@NotNull
CloudFrontWebDistributionProps props)
scope - This parameter is required.id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public static IDistribution fromDistributionAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CloudFrontWebDistributionAttributes attrs)
scope - This parameter is required.id - This parameter is required.attrs - This parameter is required.@Stability(value=Stable) @NotNull public 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@Stability(value=Stable) @NotNull public String getDistributionId()
getDistributionId in interface IDistribution@Stability(value=Deprecated) @Deprecated @NotNull public 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@Stability(value=Stable) @Nullable public IBucket getLoggingBucket()
If logging is not enabled for this distribution - this property will be undefined.
Copyright © 2022. All rights reserved.