CfnDistributionTenantProps

class aws_cdk.aws_cloudfront.CfnDistributionTenantProps(*, distribution_id, domains, name, connection_group_id=None, customizations=None, enabled=None, managed_certificate_request=None, parameters=None, tags=None)

Bases: object

Properties for defining a CfnDistributionTenant.

Parameters:
  • distribution_id (str) – The ID of the multi-tenant distribution.

  • domains (Sequence[str]) – The domains associated with the distribution tenant.

  • name (str) – The name of the distribution tenant.

  • connection_group_id (Optional[str]) – 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 (Union[IResolvable, CustomizationsProperty, Dict[str, Any], None]) – 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 (Union[bool, IResolvable, None]) – Indicates whether the distribution tenant is in an enabled state. If disabled, the distribution tenant won’t serve traffic.

  • managed_certificate_request (Union[IResolvable, ManagedCertificateRequestProperty, Dict[str, Any], None]) – An object that represents the request for the Amazon CloudFront managed ACM certificate.

  • parameters (Union[IResolvable, Sequence[Union[IResolvable, ParameterProperty, Dict[str, Any]]], None]) – 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 (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – A complex type that contains zero or more Tag elements.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html

ExampleMetadata:

infused

Example:

# Create the simple Origin
my_bucket = s3.Bucket(self, "myBucket")
s3_origin = origins.S3BucketOrigin.with_origin_access_control(my_bucket,
    origin_access_levels=[cloudfront.AccessLevel.READ, cloudfront.AccessLevel.LIST]
)

# Create the Distribution construct
my_multi_tenant_distribution = cloudfront.Distribution(self, "cf-hosted-distribution",
    default_behavior=cloudfront.BehaviorOptions(
        origin=s3_origin
    ),
    default_root_object="index.html"
)

# Access the underlying L1 CfnDistribution to configure SaaS Manager properties which are not yet available in the L2 Distribution construct
cfn_distribution = my_multi_tenant_distribution.node.default_child

default_cache_behavior = cloudfront.CfnDistribution.DefaultCacheBehaviorProperty(
    target_origin_id=my_bucket.bucket_arn,
    viewer_protocol_policy="allow-all",
    compress=False,
    allowed_methods=["GET", "HEAD"],
    cache_policy_id=cloudfront.CachePolicy.CACHING_OPTIMIZED.cache_policy_id
)
# Create the updated distributionConfig
distribution_config = cloudfront.CfnDistribution.DistributionConfigProperty(
    default_cache_behavior=default_cache_behavior,
    enabled=True,
    # the properties below are optional
    connection_mode="tenant-only",
    origins=[cloudfront.CfnDistribution.OriginProperty(
        id=my_bucket.bucket_arn,
        domain_name=my_bucket.bucket_domain_name,
        s3_origin_config=cloudfront.CfnDistribution.S3OriginConfigProperty(),
        origin_path="/{{tenantName}}"
    )
    ],
    tenant_config=cloudfront.CfnDistribution.TenantConfigProperty(
        parameter_definitions=[cloudfront.CfnDistribution.ParameterDefinitionProperty(
            definition=cloudfront.CfnDistribution.DefinitionProperty(
                string_schema=cloudfront.CfnDistribution.StringSchemaProperty(
                    required=False,
                    # the properties below are optional
                    comment="tenantName",
                    default_value="root"
                )
            ),
            name="tenantName"
        )
        ]
    )
)

# Override the distribution configuration to enable multi-tenancy.
cfn_distribution.distribution_config = distribution_config

# Create a connection group so we have access to the RoutingEndpoint associated with the tenant we are about to create
connection_group = cloudfront.CfnConnectionGroup(self, "self-hosted-connection-group",
    enabled=True,
    ipv6_enabled=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
CfnOutput(self, "RoutingEndpoint",
    value=connection_group.attr_routing_endpoint,
    description="CloudFront Routing Endpoint to be added to my hosted zone CNAME records"
)

# Create a distribution tenant with a self-hosted domain.
self_hosted_tenant = cloudfront.CfnDistributionTenant(self, "self-hosted-tenant",
    distribution_id=my_multi_tenant_distribution.distribution_id,
    connection_group_id=connection_group.attr_id,
    name="self-hosted-tenant",
    domains=["self-hosted-tenant.my.domain.com"],
    enabled=True,
    managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
        primary_domain_name="self-hosted-tenant.my.domain.com",
        validation_token_host="self-hosted"
    )
)

Attributes

connection_group_id

The ID of the connection group for the distribution tenant.

If you don’t specify a connection group, CloudFront uses the default connection group.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-connectiongroupid

customizations

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-customizations

distribution_id

The ID of the multi-tenant distribution.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-distributionid

domains

The domains associated with the distribution tenant.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-domains

enabled

Indicates whether the distribution tenant is in an enabled state.

If disabled, the distribution tenant won’t serve traffic.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-enabled

managed_certificate_request

An object that represents the request for the Amazon CloudFront managed ACM certificate.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-managedcertificaterequest

name

The name of the distribution tenant.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-name

parameters

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.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-parameters

tags

A complex type that contains zero or more Tag elements.

See:

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distributiontenant.html#cfn-cloudfront-distributiontenant-tags