Class CfnDistribution
A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnDistribution : CfnResource, IInspectable, ITaggable
Syntax (vb)
Public Class CfnDistribution Inherits CfnResource Implements IInspectable, ITaggable
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
Examples
// Create the simple Origin
var myBucket = new Bucket(this, "myBucket");
var s3Origin = S3BucketOrigin.WithOriginAccessControl(myBucket, new S3BucketOriginWithOACProps {
OriginAccessLevels = new [] { AccessLevel.READ, AccessLevel.LIST }
});
// Create the Distribution construct
var myMultiTenantDistribution = new Distribution(this, "distribution", new DistributionProps {
DefaultBehavior = new BehaviorOptions {
Origin = s3Origin
},
DefaultRootObject = "index.html"
});
// Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
var cfnDistribution = (CfnDistribution)myMultiTenantDistribution.Node.DefaultChild;
var defaultCacheBehavior = new DefaultCacheBehaviorProperty {
TargetOriginId = myBucket.BucketArn,
ViewerProtocolPolicy = "allow-all",
Compress = false,
AllowedMethods = new [] { "GET", "HEAD" },
CachePolicyId = CachePolicy.CACHING_OPTIMIZED.CachePolicyId
};
// Create the updated distributionConfig
var distributionConfig = new DistributionConfigProperty {
DefaultCacheBehavior = defaultCacheBehavior,
Enabled = true,
// the properties below are optional
ConnectionMode = "tenant-only",
Origins = new [] { new OriginProperty {
Id = myBucket.BucketArn,
DomainName = myBucket.BucketDomainName,
S3OriginConfig = new S3OriginConfigProperty { },
OriginPath = "/{{tenantName}}"
} },
TenantConfig = new TenantConfigProperty {
ParameterDefinitions = new [] { new ParameterDefinitionProperty {
Definition = new DefinitionProperty {
StringSchema = new StringSchemaProperty {
Required = false,
// the properties below are optional
Comment = "tenantName",
DefaultValue = "root"
}
},
Name = "tenantName"
} }
}
};
// Override the distribution configuration to enable multi-tenancy.
cfnDistribution.DistributionConfig = distributionConfig;
// Create a distribution tenant using an existing ACM certificate
var cfnDistributionTenant = new CfnDistributionTenant(this, "distribution-tenant", new CfnDistributionTenantProps {
DistributionId = myMultiTenantDistribution.DistributionId,
Domains = new [] { "my-tenant.my.domain.com" },
Name = "my-tenant",
Enabled = true,
Parameters = new [] { new ParameterProperty {
Name = "tenantName",
Value = "app"
} },
Customizations = new CustomizationsProperty {
Certificate = new CertificateProperty {
Arn = "REPLACE_WITH_ARN"
}
}
});
Synopsis
Constructors
CfnDistribution(Construct, string, ICfnDistributionProps) | A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery. |
Properties
AttrDomainName | The domain name of the resource, such as |
AttrId | The distribution's identifier. |
CFN_RESOURCE_TYPE_NAME | The CloudFormation resource type name for this resource class. |
CfnProperties | A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery. |
DistributionConfig | The distribution's configuration. |
Tags | Tag Manager which manages the tags for this resource. |
TagsRaw | A complex type that contains zero or more |
Methods
Inspect(TreeInspector) | Examines the CloudFormation resource and discloses attributes. |
RenderProperties(IDictionary<string, object>) | A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery. |
Constructors
CfnDistribution(Construct, string, ICfnDistributionProps)
A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.
public CfnDistribution(Construct scope, string id, ICfnDistributionProps props)
Parameters
- scope Construct
Scope in which this resource is defined.
- id string
Construct identifier for this resource (unique in its scope).
- props ICfnDistributionProps
Resource properties.
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
Properties
AttrDomainName
The domain name of the resource, such as d111111abcdef8.cloudfront.net
.
public virtual string AttrDomainName { get; }
Property Value
Remarks
CloudformationAttribute: DomainName
AttrId
The distribution's identifier.
public virtual string AttrId { get; }
Property Value
Remarks
For example: E1U5RQF7T870K0
.
CloudformationAttribute: Id
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
public static string CFN_RESOURCE_TYPE_NAME { get; }
Property Value
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
CfnProperties
A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.
protected override IDictionary<string, object> CfnProperties { get; }
Property Value
Overrides
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
DistributionConfig
The distribution's configuration.
public virtual object DistributionConfig { get; set; }
Property Value
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
Tags
Tag Manager which manages the tags for this resource.
public virtual TagManager Tags { get; }
Property Value
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
TagsRaw
A complex type that contains zero or more Tag
elements.
public virtual ICfnTag[]? TagsRaw { get; set; }
Property Value
ICfnTag[]
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
Methods
Inspect(TreeInspector)
Examines the CloudFormation resource and discloses attributes.
public virtual void Inspect(TreeInspector inspector)
Parameters
- inspector TreeInspector
tree inspector to collect and process attributes.
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused
RenderProperties(IDictionary<string, object>)
A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.
protected override IDictionary<string, object> RenderProperties(IDictionary<string, object> props)
Parameters
- props IDictionary<string, object>
Returns
Overrides
Remarks
CloudformationResource: AWS::CloudFront::Distribution
ExampleMetadata: infused