Interface CfnDistributionTenantProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
CfnDistributionTenantProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.112.0 (build de1bc80)", date="2025-07-16T11:43:11.027Z") @Stability(Stable) public interface CfnDistributionTenantProps extends software.amazon.jsii.JsiiSerializable
Properties for defining a CfnDistributionTenant.

Example:

 // Create the simple Origin
 Bucket myBucket = new Bucket(this, "myBucket");
 IOrigin s3Origin = S3BucketOrigin.withOriginAccessControl(myBucket, S3BucketOriginWithOACProps.builder()
         .originAccessLevels(List.of(AccessLevel.READ, AccessLevel.LIST))
         .build());
 // Create the Distribution construct
 Distribution myMultiTenantDistribution = Distribution.Builder.create(this, "cf-hosted-distribution")
         .defaultBehavior(BehaviorOptions.builder()
                 .origin(s3Origin)
                 .build())
         .defaultRootObject("index.html")
         .build();
 // Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
 CfnDistribution cfnDistribution = (CfnDistribution)myMultiTenantDistribution.getNode().getDefaultChild();
 DefaultCacheBehaviorProperty defaultCacheBehavior = DefaultCacheBehaviorProperty.builder()
         .targetOriginId(myBucket.getBucketArn())
         .viewerProtocolPolicy("allow-all")
         .compress(false)
         .allowedMethods(List.of("GET", "HEAD"))
         .cachePolicyId(CachePolicy.CACHING_OPTIMIZED.getCachePolicyId())
         .build();
 // Create the updated distributionConfig
 DistributionConfigProperty distributionConfig = DistributionConfigProperty.builder()
         .defaultCacheBehavior(defaultCacheBehavior)
         .enabled(true)
         // the properties below are optional
         .connectionMode("tenant-only")
         .origins(List.of(OriginProperty.builder()
                 .id(myBucket.getBucketArn())
                 .domainName(myBucket.getBucketDomainName())
                 .s3OriginConfig(S3OriginConfigProperty.builder().build())
                 .originPath("/{{tenantName}}")
                 .build()))
         .tenantConfig(TenantConfigProperty.builder()
                 .parameterDefinitions(List.of(ParameterDefinitionProperty.builder()
                         .definition(DefinitionProperty.builder()
                                 .stringSchema(StringSchemaProperty.builder()
                                         .required(false)
                                         // the properties below are optional
                                         .comment("tenantName")
                                         .defaultValue("root")
                                         .build())
                                 .build())
                         .name("tenantName")
                         .build()))
                 .build())
         .build();
 // Override the distribution configuration to enable multi-tenancy.
 cfnDistribution.getDistributionConfig() = distributionConfig;
 // Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
 CfnConnectionGroup connectionGroup = CfnConnectionGroup.Builder.create(this, "self-hosted-connection-group")
         .enabled(true)
         .ipv6Enabled(true)
         .name("self-hosted-connection-group")
         .build();
 // Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
 // Export the RoutingEndpoint, skip this step if you'd prefer to fetch it from the CloudFront console or via Cloudfront.ListConnectionGroups API
 CfnOutput.Builder.create(this, "RoutingEndpoint")
         .value(connectionGroup.getAttrRoutingEndpoint())
         .description("CloudFront Routing Endpoint to be added to my hosted zone CNAME records")
         .build();
 // Create a distribution tenant with a self-hosted domain.
 CfnDistributionTenant selfHostedTenant = CfnDistributionTenant.Builder.create(this, "self-hosted-tenant")
         .distributionId(myMultiTenantDistribution.getDistributionId())
         .connectionGroupId(connectionGroup.getAttrId())
         .name("self-hosted-tenant")
         .domains(List.of("self-hosted-tenant.my.domain.com"))
         .enabled(true)
         .managedCertificateRequest(ManagedCertificateRequestProperty.builder()
                 .primaryDomainName("self-hosted-tenant.my.domain.com")
                 .validationTokenHost("self-hosted")
                 .build())
         .build();
 

See Also: