Class CfnDistribution.DistributionConfigProperty
A distribution configuration.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DistributionConfigProperty : Object, CfnDistribution.IDistributionConfigProperty
Syntax (vb)
Public Class DistributionConfigProperty
Inherits Object
Implements CfnDistribution.IDistributionConfigProperty
Remarks
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;
var distributionConfigProperty = new DistributionConfigProperty {
DefaultCacheBehavior = new DefaultCacheBehaviorProperty {
TargetOriginId = "targetOriginId",
ViewerProtocolPolicy = "viewerProtocolPolicy",
// the properties below are optional
AllowedMethods = new [] { "allowedMethods" },
CachedMethods = new [] { "cachedMethods" },
CachePolicyId = "cachePolicyId",
Compress = false,
DefaultTtl = 123,
FieldLevelEncryptionId = "fieldLevelEncryptionId",
ForwardedValues = new ForwardedValuesProperty {
QueryString = false,
// the properties below are optional
Cookies = new CookiesProperty {
Forward = "forward",
// the properties below are optional
WhitelistedNames = new [] { "whitelistedNames" }
},
Headers = new [] { "headers" },
QueryStringCacheKeys = new [] { "queryStringCacheKeys" }
},
FunctionAssociations = new [] { new FunctionAssociationProperty {
EventType = "eventType",
FunctionArn = "functionArn"
} },
LambdaFunctionAssociations = new [] { new LambdaFunctionAssociationProperty {
EventType = "eventType",
IncludeBody = false,
LambdaFunctionArn = "lambdaFunctionArn"
} },
MaxTtl = 123,
MinTtl = 123,
OriginRequestPolicyId = "originRequestPolicyId",
RealtimeLogConfigArn = "realtimeLogConfigArn",
ResponseHeadersPolicyId = "responseHeadersPolicyId",
SmoothStreaming = false,
TrustedKeyGroups = new [] { "trustedKeyGroups" },
TrustedSigners = new [] { "trustedSigners" }
},
Enabled = false,
// the properties below are optional
Aliases = new [] { "aliases" },
CacheBehaviors = new [] { new CacheBehaviorProperty {
PathPattern = "pathPattern",
TargetOriginId = "targetOriginId",
ViewerProtocolPolicy = "viewerProtocolPolicy",
// the properties below are optional
AllowedMethods = new [] { "allowedMethods" },
CachedMethods = new [] { "cachedMethods" },
CachePolicyId = "cachePolicyId",
Compress = false,
DefaultTtl = 123,
FieldLevelEncryptionId = "fieldLevelEncryptionId",
ForwardedValues = new ForwardedValuesProperty {
QueryString = false,
// the properties below are optional
Cookies = new CookiesProperty {
Forward = "forward",
// the properties below are optional
WhitelistedNames = new [] { "whitelistedNames" }
},
Headers = new [] { "headers" },
QueryStringCacheKeys = new [] { "queryStringCacheKeys" }
},
FunctionAssociations = new [] { new FunctionAssociationProperty {
EventType = "eventType",
FunctionArn = "functionArn"
} },
LambdaFunctionAssociations = new [] { new LambdaFunctionAssociationProperty {
EventType = "eventType",
IncludeBody = false,
LambdaFunctionArn = "lambdaFunctionArn"
} },
MaxTtl = 123,
MinTtl = 123,
OriginRequestPolicyId = "originRequestPolicyId",
RealtimeLogConfigArn = "realtimeLogConfigArn",
ResponseHeadersPolicyId = "responseHeadersPolicyId",
SmoothStreaming = false,
TrustedKeyGroups = new [] { "trustedKeyGroups" },
TrustedSigners = new [] { "trustedSigners" }
} },
CnamEs = new [] { "cnamEs" },
Comment = "comment",
ContinuousDeploymentPolicyId = "continuousDeploymentPolicyId",
CustomErrorResponses = new [] { new CustomErrorResponseProperty {
ErrorCode = 123,
// the properties below are optional
ErrorCachingMinTtl = 123,
ResponseCode = 123,
ResponsePagePath = "responsePagePath"
} },
CustomOrigin = new LegacyCustomOriginProperty {
DnsName = "dnsName",
OriginProtocolPolicy = "originProtocolPolicy",
OriginSslProtocols = new [] { "originSslProtocols" },
// the properties below are optional
HttpPort = 123,
HttpsPort = 123
},
DefaultRootObject = "defaultRootObject",
HttpVersion = "httpVersion",
Ipv6Enabled = false,
Logging = new LoggingProperty {
Bucket = "bucket",
// the properties below are optional
IncludeCookies = false,
Prefix = "prefix"
},
OriginGroups = new OriginGroupsProperty {
Quantity = 123,
// the properties below are optional
Items = new [] { new OriginGroupProperty {
FailoverCriteria = new OriginGroupFailoverCriteriaProperty {
StatusCodes = new StatusCodesProperty {
Items = new [] { 123 },
Quantity = 123
}
},
Id = "id",
Members = new OriginGroupMembersProperty {
Items = new [] { new OriginGroupMemberProperty {
OriginId = "originId"
} },
Quantity = 123
}
} }
},
Origins = new [] { new OriginProperty {
DomainName = "domainName",
Id = "id",
// the properties below are optional
ConnectionAttempts = 123,
ConnectionTimeout = 123,
CustomOriginConfig = new CustomOriginConfigProperty {
OriginProtocolPolicy = "originProtocolPolicy",
// the properties below are optional
HttpPort = 123,
HttpsPort = 123,
OriginKeepaliveTimeout = 123,
OriginReadTimeout = 123,
OriginSslProtocols = new [] { "originSslProtocols" }
},
OriginAccessControlId = "originAccessControlId",
OriginCustomHeaders = new [] { new OriginCustomHeaderProperty {
HeaderName = "headerName",
HeaderValue = "headerValue"
} },
OriginPath = "originPath",
OriginShield = new OriginShieldProperty {
Enabled = false,
OriginShieldRegion = "originShieldRegion"
},
S3OriginConfig = new S3OriginConfigProperty {
OriginAccessIdentity = "originAccessIdentity"
}
} },
PriceClass = "priceClass",
Restrictions = new RestrictionsProperty {
GeoRestriction = new GeoRestrictionProperty {
RestrictionType = "restrictionType",
// the properties below are optional
Locations = new [] { "locations" }
}
},
S3Origin = new LegacyS3OriginProperty {
DnsName = "dnsName",
// the properties below are optional
OriginAccessIdentity = "originAccessIdentity"
},
Staging = false,
ViewerCertificate = new ViewerCertificateProperty {
AcmCertificateArn = "acmCertificateArn",
CloudFrontDefaultCertificate = false,
IamCertificateId = "iamCertificateId",
MinimumProtocolVersion = "minimumProtocolVersion",
SslSupportMethod = "sslSupportMethod"
},
WebAclId = "webAclId"
};
Synopsis
Constructors
DistributionConfigProperty() |
Properties
Aliases | A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution. |
CacheBehaviors | A complex type that contains zero or more |
CnamEs | An alias for the CloudFront distribution's domain name. |
Comment | A comment to describe the distribution. |
ContinuousDeploymentPolicyId | The identifier of a continuous deployment policy. |
CustomErrorResponses | A complex type that controls the following:. |
CustomOrigin | The user-defined HTTP server that serves as the origin for content that CloudFront distributes. |
DefaultCacheBehavior | A complex type that describes the default cache behavior if you don't specify a |
DefaultRootObject | The object that you want CloudFront to request from your origin (for example, |
Enabled | From this field, you can enable or disable the selected distribution. |
HttpVersion | (Optional) Specify the HTTP version(s) that you want viewers to use to communicate with CloudFront . |
Ipv6Enabled | If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify |
Logging | A complex type that controls whether access logs are written for the distribution. |
OriginGroups | A complex type that contains information about origin groups for this distribution. |
Origins | A complex type that contains information about origins for this distribution. |
PriceClass | The price class that corresponds with the maximum price that you want to pay for CloudFront service. |
Restrictions | A complex type that identifies ways in which you want to restrict distribution of your content. |
S3Origin | The origin as an Amazon S3 bucket. |
Staging | A Boolean that indicates whether this is a staging distribution. |
ViewerCertificate | A complex type that determines the distribution's SSL/TLS configuration for communicating with viewers. |
WebAclId | A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution. |
Constructors
DistributionConfigProperty()
public DistributionConfigProperty()
Properties
Aliases
A complex type that contains information about CNAMEs (alternate domain names), if any, for this distribution.
public string[] Aliases { get; set; }
Property Value
System.String[]
Remarks
CacheBehaviors
A complex type that contains zero or more CacheBehavior
elements.
public object CacheBehaviors { get; set; }
Property Value
System.Object
Remarks
CnamEs
An alias for the CloudFront distribution's domain name.
public string[] CnamEs { get; set; }
Property Value
System.String[]
Remarks
This property is legacy. We recommend that you use Aliases instead.
Comment
A comment to describe the distribution.
public string Comment { get; set; }
Property Value
System.String
Remarks
The comment cannot be longer than 128 characters.
Default: - ""
ContinuousDeploymentPolicyId
The identifier of a continuous deployment policy.
public string ContinuousDeploymentPolicyId { get; set; }
Property Value
System.String
Remarks
For more information, see CreateContinuousDeploymentPolicy
.
CustomErrorResponses
A complex type that controls the following:.
public object CustomErrorResponses { get; set; }
Property Value
System.Object
Remarks
For more information about custom error pages, see Customizing Error Responses in the Amazon CloudFront Developer Guide .
CustomOrigin
The user-defined HTTP server that serves as the origin for content that CloudFront distributes.
public object CustomOrigin { get; set; }
Property Value
System.Object
Remarks
This property is legacy. We recommend that you use Origin instead.
DefaultCacheBehavior
A complex type that describes the default cache behavior if you don't specify a CacheBehavior
element or if files don't match any of the values of PathPattern
in CacheBehavior
elements.
public object DefaultCacheBehavior { get; set; }
Property Value
System.Object
Remarks
You must create exactly one default cache behavior.
DefaultRootObject
The object that you want CloudFront to request from your origin (for example, index.html
) when a viewer requests the root URL for your distribution ( https://www.example.com
) instead of an object in your distribution ( https://www.example.com/product-description.html
). Specifying a default root object avoids exposing the contents of your distribution.
public string DefaultRootObject { get; set; }
Property Value
System.String
Remarks
Specify only the object name, for example, index.html
. Don't add a /
before the object name.
If you don't want to specify a default root object when you create a distribution, include an empty DefaultRootObject
element.
To delete the default root object from an existing distribution, update the distribution configuration and include an empty DefaultRootObject
element.
To replace the default root object, update the distribution configuration and specify the new object.
For more information about the default root object, see Creating a Default Root Object in the Amazon CloudFront Developer Guide .
Default: - ""
Enabled
From this field, you can enable or disable the selected distribution.
public object Enabled { get; set; }
Property Value
System.Object
Remarks
HttpVersion
(Optional) Specify the HTTP version(s) that you want viewers to use to communicate with CloudFront .
public string HttpVersion { get; set; }
Property Value
System.String
Remarks
The default value for new distributions is http1.1
.
For viewers and CloudFront to use HTTP/2, viewers must support TLSv1.2 or later, and must support Server Name Indication (SNI).
For viewers and CloudFront to use HTTP/3, viewers must support TLSv1.3 and Server Name Indication (SNI). CloudFront supports HTTP/3 connection migration to allow the viewer to switch networks without losing connection. For more information about connection migration, see Connection Migration at RFC 9000. For more information about supported TLSv1.3 ciphers, see Supported protocols and ciphers between viewers and CloudFront .
Default: - "http1.1"
Ipv6Enabled
If you want CloudFront to respond to IPv6 DNS requests with an IPv6 address for your distribution, specify true
.
public object Ipv6Enabled { get; set; }
Property Value
System.Object
Remarks
If you specify false
, CloudFront responds to IPv6 DNS requests with the DNS response code NOERROR
and with no IP addresses. This allows viewers to submit a second request, for an IPv4 address for your distribution.
In general, you should enable IPv6 if you have users on IPv6 networks who want to access your content. However, if you're using signed URLs or signed cookies to restrict access to your content, and if you're using a custom policy that includes the IpAddress
parameter to restrict the IP addresses that can access your content, don't enable IPv6. If you want to restrict access to some content by IP address and not restrict access to other content (or restrict access but not by IP address), you can create two distributions. For more information, see Creating a Signed URL Using a Custom Policy in the Amazon CloudFront Developer Guide .
If you're using an Amazon Route 53 AWS Integration alias resource record set to route traffic to your CloudFront distribution, you need to create a second alias resource record set when both of the following are true:
For more information, see Routing Traffic to an Amazon CloudFront Web Distribution by Using Your Domain Name in the Amazon Route 53 AWS Integration Developer Guide .
If you created a CNAME resource record set, either with Amazon Route 53 AWS Integration or with another DNS service, you don't need to make any changes. A CNAME record will route traffic to your distribution regardless of the IP address format of the viewer request.
Logging
A complex type that controls whether access logs are written for the distribution.
public object Logging { get; set; }
Property Value
System.Object
Remarks
For more information about logging, see Access Logs in the Amazon CloudFront Developer Guide .
OriginGroups
A complex type that contains information about origin groups for this distribution.
public object OriginGroups { get; set; }
Property Value
System.Object
Remarks
Specify a value for either the Origins
or OriginGroups
property.
Origins
A complex type that contains information about origins for this distribution.
public object Origins { get; set; }
Property Value
System.Object
Remarks
Specify a value for either the Origins
or OriginGroups
property.
PriceClass
The price class that corresponds with the maximum price that you want to pay for CloudFront service.
public string PriceClass { get; set; }
Property Value
System.String
Remarks
If you specify PriceClass_All
, CloudFront responds to requests for your objects from all CloudFront edge locations.
If you specify a price class other than PriceClass_All
, CloudFront serves your objects from the CloudFront edge location that has the lowest latency among the edge locations in your price class. Viewers who are in or near regions that are excluded from your specified price class may encounter slower performance.
For more information about price classes, see Choosing the Price Class for a CloudFront Distribution in the Amazon CloudFront Developer Guide . For information about CloudFront pricing, including how price classes (such as Price Class 100) map to CloudFront regions, see Amazon CloudFront Pricing .
Default: - "PriceClass_All"
Restrictions
A complex type that identifies ways in which you want to restrict distribution of your content.
public object Restrictions { get; set; }
Property Value
System.Object
Remarks
S3Origin
The origin as an Amazon S3 bucket.
public object S3Origin { get; set; }
Property Value
System.Object
Remarks
This property is legacy. We recommend that you use Origin instead.
Staging
A Boolean that indicates whether this is a staging distribution.
public object Staging { get; set; }
Property Value
System.Object
Remarks
When this value is true
, this is a staging distribution. When this value is false
, this is not a staging distribution.
ViewerCertificate
A complex type that determines the distribution's SSL/TLS configuration for communicating with viewers.
public object ViewerCertificate { get; set; }
Property Value
System.Object
Remarks
WebAclId
A unique identifier that specifies the AWS WAF web ACL, if any, to associate with this distribution.
public string WebAclId { get; set; }
Property Value
System.String
Remarks
To specify a web ACL created using the latest version of AWS WAF , use the ACL ARN, for example arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
. To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example a1b2c3d4-5678-90ab-cdef-EXAMPLE11111
.
AWS WAF is a web application firewall that lets you monitor the HTTP and HTTPS requests that are forwarded to CloudFront, and lets you control access to your content. Based on conditions that you specify, such as the IP addresses that requests originate from or the values of query strings, CloudFront responds to requests either with the requested content or with an HTTP 403 status code (Forbidden). You can also configure CloudFront to return a custom error page when a request is blocked. For more information about AWS WAF , see the AWS WAF Developer Guide .
Default: - ""