interface CfnDistributionTenantProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CloudFront.CfnDistributionTenantProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#CfnDistributionTenantProps |
![]() | software.amazon.awscdk.services.cloudfront.CfnDistributionTenantProps |
![]() | aws_cdk.aws_cloudfront.CfnDistributionTenantProps |
![]() | aws-cdk-lib » aws_cloudfront » CfnDistributionTenantProps |
Properties for defining a CfnDistributionTenant
.
Example
// 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 so we have access to the RoutingEndpoint associated with the tenant we are about to create
const connectionGroup = new cloudfront.CfnConnectionGroup(this, 'self-hosted-connection-group', {
enabled: true,
ipv6Enabled: true,
name: 'self-hosted-connection-group',
});
// Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
new CfnOutput(this, 'RoutingEndpoint', {
value: connectionGroup.attrRoutingEndpoint,
description: 'CloudFront Routing Endpoint to be added to my hosted zone CNAME records',
});
// Create a distribution tenant with a self-hosted domain.
const selfHostedTenant = new cloudfront.CfnDistributionTenant(this, 'self-hosted-tenant', {
distributionId: myMultiTenantDistribution.distributionId,
connectionGroupId: connectionGroup.attrId,
name: 'self-hosted-tenant',
domains: ['self-hosted-tenant.my.domain.com'],
enabled: true,
managedCertificateRequest: {
primaryDomainName: 'self-hosted-tenant.my.domain.com',
validationTokenHost: 'self-hosted',
},
});
Properties
Name | Type | Description |
---|---|---|
distribution | string | The ID of the multi-tenant distribution. |
domains | string[] | The domains associated with the distribution tenant. |
name | string | The name of the distribution tenant. |
connection | string | The ID of the connection group for the distribution tenant. |
customizations? | IResolvable | Customizations | Customizations for the distribution tenant. |
enabled? | boolean | IResolvable | Indicates whether the distribution tenant is in an enabled state. |
managed | IResolvable | Managed | An object that represents the request for the Amazon CloudFront managed ACM certificate. |
parameters? | IResolvable | IResolvable | Parameter [] | A list of parameter values to add to the resource. |
tags? | Cfn [] | A complex type that contains zero or more Tag elements. |
distributionId
Type:
string
The ID of the multi-tenant distribution.
domains
Type:
string[]
The domains associated with the distribution tenant.
name
Type:
string
The name of the distribution tenant.
connectionGroupId?
Type:
string
(optional)
The ID of the connection group for the distribution tenant.
If you don't specify a connection group, CloudFront uses the default connection group.
customizations?
Type:
IResolvable
|
Customizations
(optional)
Customizations for the distribution tenant.
For each distribution tenant, you can specify the geographic restrictions, and the Amazon Resource Names (ARNs) for the ACM certificate and AWS WAF web ACL. These are specific values that you can override or disable from the multi-tenant distribution that was used to create the distribution tenant.
enabled?
Type:
boolean |
IResolvable
(optional)
Indicates whether the distribution tenant is in an enabled state.
If disabled, the distribution tenant won't serve traffic.
managedCertificateRequest?
Type:
IResolvable
|
Managed
(optional)
An object that represents the request for the Amazon CloudFront managed ACM certificate.
parameters?
Type:
IResolvable
|
IResolvable
|
Parameter
[]
(optional)
A list of parameter values to add to the resource.
A parameter is specified as a key-value pair. A valid parameter value must exist for any parameter that is marked as required in the multi-tenant distribution.
tags?
Type:
Cfn
[]
(optional)
A complex type that contains zero or more Tag
elements.