interface CfnConnectionGroupProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CloudFront.CfnConnectionGroupProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#CfnConnectionGroupProps |
![]() | software.amazon.awscdk.services.cloudfront.CfnConnectionGroupProps |
![]() | aws_cdk.aws_cloudfront.CfnConnectionGroupProps |
![]() | aws-cdk-lib » aws_cloudfront » CfnConnectionGroupProps |
Properties for defining a CfnConnectionGroup
.
Example
import * as route53 from 'aws-cdk-lib/aws-route53';
// Create the simple Origin
const myBucket = new s3.Bucket(this, 'myBucket');
const s3Origin = origins.S3BucketOrigin.withOriginAccessControl(myBucket, {
originAccessLevels: [cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST],
});
// Create the Distribution construct
const myMultiTenantDistribution = new cloudfront.Distribution(this, 'cf-hosted-distribution', {
defaultBehavior: {
origin: s3Origin,
},
defaultRootObject: 'index.html', // recommended to specify
});
// Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
const cfnDistribution = myMultiTenantDistribution.node.defaultChild as cloudfront.CfnDistribution;
const defaultCacheBehavior: cloudfront.CfnDistribution.DefaultCacheBehaviorProperty = {
targetOriginId: myBucket.bucketArn,
viewerProtocolPolicy: 'allow-all',
compress: false,
allowedMethods: ['GET', 'HEAD'],
cachePolicyId: cloudfront.CachePolicy.CACHING_OPTIMIZED.cachePolicyId
};
// Create the updated distributionConfig
const distributionConfig: cloudfront.CfnDistribution.DistributionConfigProperty = {
defaultCacheBehavior: defaultCacheBehavior,
enabled: true,
// the properties below are optional
connectionMode: 'tenant-only',
origins: [
{
id: myBucket.bucketArn,
domainName: myBucket.bucketDomainName,
s3OriginConfig: {},
originPath: "/{{tenantName}}"
},
],
tenantConfig: {
parameterDefinitions: [
{
definition: {
stringSchema: {
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
const connectionGroup = new cloudfront.CfnConnectionGroup(this, 'cf-hosted-connection-group', {
enabled: true,
ipv6Enabled: true,
name: 'my-connection-group',
});
// Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
const hostedZoneId = 'YOUR_HOSTED_ZONE_ID';
const zoneName = 'my.domain.com';
const hostedZone = route53.HostedZone.fromHostedZoneAttributes(this, 'hosted-zone', {
hostedZoneId,
zoneName,
});
const record = new route53.CnameRecord(this, 'cname-record', {
domainName: connectionGroup.attrRoutingEndpoint,
zone: hostedZone,
recordName: 'cf-hosted-tenant.my.domain.com',
});
// Create the cloudfront-hosted tenant, passing in the previously created connection group
const cloudfrontHostedTenant = new cloudfront.CfnDistributionTenant(this, 'cf-hosted-tenant', {
distributionId: myMultiTenantDistribution.distributionId,
name: 'cf-hosted-tenant',
domains: ['cf-hosted-tenant.my.domain.com'],
connectionGroupId: connectionGroup.attrId,
enabled: true,
managedCertificateRequest: {
validationTokenHost: 'cloudfront'
},
});
Properties
Name | Type | Description |
---|---|---|
name | string | The name of the connection group. |
anycast | string | The ID of the Anycast static IP list. |
enabled? | boolean | IResolvable | Whether the connection group is enabled. |
ipv6 | boolean | IResolvable | IPv6 is enabled for the connection group. |
tags? | Cfn [] | A complex type that contains zero or more Tag elements. |
name
Type:
string
The name of the connection group.
anycastIpListId?
Type:
string
(optional)
The ID of the Anycast static IP list.
enabled?
Type:
boolean |
IResolvable
(optional)
Whether the connection group is enabled.
ipv6Enabled?
Type:
boolean |
IResolvable
(optional)
IPv6 is enabled for the connection group.
tags?
Type:
Cfn
[]
(optional)
A complex type that contains zero or more Tag
elements.