CfnConnectionGroupProps

class aws_cdk.aws_cloudfront.CfnConnectionGroupProps(*, name, anycast_ip_list_id=None, enabled=None, ipv6_enabled=None, tags=None)

Bases: object

Properties for defining a CfnConnectionGroup.

Parameters:
  • name (str) – The name of the connection group.

  • anycast_ip_list_id (Optional[str]) – The ID of the Anycast static IP list.

  • enabled (Union[bool, IResolvable, None]) – Whether the connection group is enabled.

  • ipv6_enabled (Union[bool, IResolvable, None]) – IPv6 is enabled for the connection group.

  • 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-connectiongroup.html

ExampleMetadata:

infused

Example:

import aws_cdk.aws_route53 as route53


# 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 and a cname record in an existing hosted zone to validate domain ownership
connection_group = cloudfront.CfnConnectionGroup(self, "cf-hosted-connection-group",
    enabled=True,
    ipv6_enabled=True,
    name="my-connection-group"
)

# Import the existing hosted zone info, replacing with your hostedZoneId and zoneName
hosted_zone_id = "YOUR_HOSTED_ZONE_ID"
zone_name = "my.domain.com"
hosted_zone = route53.HostedZone.from_hosted_zone_attributes(self, "hosted-zone",
    hosted_zone_id=hosted_zone_id,
    zone_name=zone_name
)

record = route53.CnameRecord(self, "cname-record",
    domain_name=connection_group.attr_routing_endpoint,
    zone=hosted_zone,
    record_name="cf-hosted-tenant.my.domain.com"
)

# Create the cloudfront-hosted tenant, passing in the previously created connection group
cloudfront_hosted_tenant = cloudfront.CfnDistributionTenant(self, "cf-hosted-tenant",
    distribution_id=my_multi_tenant_distribution.distribution_id,
    name="cf-hosted-tenant",
    domains=["cf-hosted-tenant.my.domain.com"],
    connection_group_id=connection_group.attr_id,
    enabled=True,
    managed_certificate_request=cloudfront.CfnDistributionTenant.ManagedCertificateRequestProperty(
        validation_token_host="cloudfront"
    )
)

Attributes

anycast_ip_list_id

The ID of the Anycast static IP list.

See:

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

enabled

Whether the connection group is enabled.

See:

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

ipv6_enabled

IPv6 is enabled for the connection group.

See:

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

name

The name of the connection group.

See:

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

tags

A complex type that contains zero or more Tag elements.

See:

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