Class CfnConnectionGroupProps
Properties for defining a CfnConnectionGroup
.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.CloudFront
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class CfnConnectionGroupProps : ICfnConnectionGroupProps
Syntax (vb)
Public Class CfnConnectionGroupProps Implements ICfnConnectionGroupProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Route53;
// 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, "cf-hosted-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 connection group and a cname record in an existing hosted zone to validate domain ownership
var connectionGroup = new CfnConnectionGroup(this, "cf-hosted-connection-group", new CfnConnectionGroupProps {
Enabled = true,
Ipv6Enabled = true,
Name = "my-connection-group"
});
// Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
var hostedZoneId = "YOUR_HOSTED_ZONE_ID";
var zoneName = "my.domain.com";
var hostedZone = HostedZone.FromHostedZoneAttributes(this, "hosted-zone", new HostedZoneAttributes {
HostedZoneId = hostedZoneId,
ZoneName = zoneName
});
var record = new CnameRecord(this, "cname-record", new CnameRecordProps {
DomainName = connectionGroup.AttrRoutingEndpoint,
Zone = hostedZone,
RecordName = "cf-hosted-tenant.my.domain.com"
});
// Create the cloudfront-hosted tenant, passing in the previously created connection group
var cloudfrontHostedTenant = new CfnDistributionTenant(this, "cf-hosted-tenant", new CfnDistributionTenantProps {
DistributionId = myMultiTenantDistribution.DistributionId,
Name = "cf-hosted-tenant",
Domains = new [] { "cf-hosted-tenant.my.domain.com" },
ConnectionGroupId = connectionGroup.AttrId,
Enabled = true,
ManagedCertificateRequest = new ManagedCertificateRequestProperty {
ValidationTokenHost = "cloudfront"
}
});
Synopsis
Constructors
CfnConnectionGroupProps() | Properties for defining a |
Properties
AnycastIpListId | The ID of the Anycast static IP list. |
Enabled | Whether the connection group is enabled. |
Ipv6Enabled | IPv6 is enabled for the connection group. |
Name | The name of the connection group. |
Tags | A complex type that contains zero or more |
Constructors
CfnConnectionGroupProps()
Properties for defining a CfnConnectionGroup
.
public CfnConnectionGroupProps()
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.Route53;
// 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, "cf-hosted-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 connection group and a cname record in an existing hosted zone to validate domain ownership
var connectionGroup = new CfnConnectionGroup(this, "cf-hosted-connection-group", new CfnConnectionGroupProps {
Enabled = true,
Ipv6Enabled = true,
Name = "my-connection-group"
});
// Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
var hostedZoneId = "YOUR_HOSTED_ZONE_ID";
var zoneName = "my.domain.com";
var hostedZone = HostedZone.FromHostedZoneAttributes(this, "hosted-zone", new HostedZoneAttributes {
HostedZoneId = hostedZoneId,
ZoneName = zoneName
});
var record = new CnameRecord(this, "cname-record", new CnameRecordProps {
DomainName = connectionGroup.AttrRoutingEndpoint,
Zone = hostedZone,
RecordName = "cf-hosted-tenant.my.domain.com"
});
// Create the cloudfront-hosted tenant, passing in the previously created connection group
var cloudfrontHostedTenant = new CfnDistributionTenant(this, "cf-hosted-tenant", new CfnDistributionTenantProps {
DistributionId = myMultiTenantDistribution.DistributionId,
Name = "cf-hosted-tenant",
Domains = new [] { "cf-hosted-tenant.my.domain.com" },
ConnectionGroupId = connectionGroup.AttrId,
Enabled = true,
ManagedCertificateRequest = new ManagedCertificateRequestProperty {
ValidationTokenHost = "cloudfront"
}
});
Properties
AnycastIpListId
The ID of the Anycast static IP list.
public string? AnycastIpListId { get; set; }
Property Value
Remarks
Enabled
Whether the connection group is enabled.
public object? Enabled { get; set; }
Property Value
Remarks
Ipv6Enabled
IPv6 is enabled for the connection group.
public object? Ipv6Enabled { get; set; }
Property Value
Remarks
Name
The name of the connection group.
public string Name { get; set; }
Property Value
Remarks
Tags
A complex type that contains zero or more Tag
elements.
public ICfnTag[]? Tags { get; set; }
Property Value
ICfnTag[]