Class CloudFrontWebDistribution
Amazon CloudFront is a global content delivery network (CDN) service that securely delivers data, videos, applications, and APIs to your viewers with low latency and high transfer speeds.
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.AWS.CloudFront.dll
Syntax (csharp)
public class CloudFrontWebDistribution : Resource, IDistribution, IResource, IConstruct, IDependable
Syntax (vb)
Public Class CloudFrontWebDistribution
Inherits Resource
Implements IDistribution, IResource, IConstruct, IDependable
Remarks
CloudFront fronts user provided content and caches it at edge locations across the world.
Here's how you can use this construct:
var sourceBucket = new Bucket(this, "Bucket");
var distribution = new CloudFrontWebDistribution(this, "MyDistribution", new CloudFrontWebDistributionProps {
OriginConfigs = new [] { new SourceConfiguration {
S3OriginSource = new S3OriginConfig {
S3BucketSource = sourceBucket
},
Behaviors = new [] { new Behavior { IsDefaultBehavior = true } }
} }
});
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.
Resource: AWS::CloudFront::Distribution
ExampleMetadata: infused
Examples
Bucket sourceBucket;
var viewerCertificate = ViewerCertificate.FromIamCertificate("MYIAMROLEIDENTIFIER", new ViewerCertificateOptions {
Aliases = new [] { "MYALIAS" }
});
new CloudFrontWebDistribution(this, "MyCfWebDistribution", new CloudFrontWebDistributionProps {
OriginConfigs = new [] { new SourceConfiguration {
S3OriginSource = new S3OriginConfig {
S3BucketSource = sourceBucket
},
Behaviors = new [] { new Behavior { IsDefaultBehavior = true } }
} },
ViewerCertificate = viewerCertificate
});
Synopsis
Constructors
CloudFrontWebDistribution(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
CloudFrontWebDistribution(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
CloudFrontWebDistribution(Construct, String, ICloudFrontWebDistributionProps) |
Properties
DistributionDomainName | The domain name created by CloudFront for this distribution. |
DistributionId | The distribution ID for this distribution. |
DomainName | (deprecated) The domain name created by CloudFront for this distribution. |
LoggingBucket | The logging bucket for this CloudFront distribution. |
Methods
FromDistributionAttributes(Construct, String, ICloudFrontWebDistributionAttributes) | Creates a construct that represents an external (imported) distribution. |
Constructors
CloudFrontWebDistribution(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected CloudFrontWebDistribution(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
CloudFrontWebDistribution(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected CloudFrontWebDistribution(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
CloudFrontWebDistribution(Construct, String, ICloudFrontWebDistributionProps)
public CloudFrontWebDistribution(Construct scope, string id, ICloudFrontWebDistributionProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ICloudFrontWebDistributionProps
Properties
DistributionDomainName
The domain name created by CloudFront for this distribution.
public virtual string DistributionDomainName { get; }
Property Value
System.String
Remarks
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.)
DistributionId
The distribution ID for this distribution.
public virtual string DistributionId { get; }
Property Value
System.String
DomainName
(deprecated) The domain name created by CloudFront for this distribution.
public virtual string DomainName { get; }
Property Value
System.String
Remarks
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.)
Stability: Deprecated
LoggingBucket
The logging bucket for this CloudFront distribution.
public virtual IBucket LoggingBucket { get; }
Property Value
Remarks
If logging is not enabled for this distribution - this property will be undefined.
Methods
FromDistributionAttributes(Construct, String, ICloudFrontWebDistributionAttributes)
Creates a construct that represents an external (imported) distribution.
public static IDistribution FromDistributionAttributes(Construct scope, string id, ICloudFrontWebDistributionAttributes attrs)
Parameters
- scope Constructs.Construct
- id System.String
- attrs ICloudFrontWebDistributionAttributes
Returns