CfnDistributionLogsMixin

class aws_cdk.mixins_preview.aws_cloudfront.mixins.CfnDistributionLogsMixin(log_type, log_delivery)

Bases: Mixin

A distribution tells CloudFront where you want content to be delivered from, and the details about how to track and manage content delivery.

See:

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

CloudformationResource:

AWS::CloudFront::Distribution

Mixin:

true

ExampleMetadata:

infused

Example:

from aws_cdk.mixins_preview.with import
import aws_cdk.mixins_preview.aws_cloudfront.mixins as cloudfront_mixins

# Create CloudFront distribution
# origin: s3.IBucket

distribution = cloudfront.Distribution(scope, "Distribution",
    default_behavior=cloudfront.BehaviorOptions(
        origin=origins.S3BucketOrigin.with_origin_access_control(origin)
    )
)

# Create destination bucket
dest_bucket = s3.Bucket(scope, "DeliveryBucket")
# Add permissions to bucket to facilitate log delivery
bucket_policy = s3.BucketPolicy(scope, "DeliveryBucketPolicy",
    bucket=dest_bucket,
    document=iam.PolicyDocument()
)
# Create S3 delivery destination for logs
destination = logs.CfnDeliveryDestination(scope, "Destination",
    destination_resource_arn=dest_bucket.bucket_arn,
    name="unique-destination-name",
    delivery_destination_type="S3"
)

distribution.with(cloudfront_mixins.CfnDistributionLogsMixin.CONNECTION_LOGS.to_destination(destination))

Create a mixin to enable vended logs for AWS::CloudFront::Distribution.

Parameters:
  • log_type (str) – Type of logs that are getting vended.

  • log_delivery (ILogsDelivery) – Object in charge of setting up the delivery source, delivery destination, and delivery connection.

Methods

apply_to(resource)

Apply vended logs configuration to the construct.

Parameters:

resource (IConstruct)

Return type:

None

supports(construct)

Check if this mixin supports the given construct (has vendedLogs property).

Parameters:

construct (IConstruct)

Return type:

bool

Attributes

ACCESS_LOGS = <aws_cdk.mixins_preview.aws_cloudfront.mixins.CfnDistributionAccessLogs object>
CONNECTION_LOGS = <aws_cdk.mixins_preview.aws_cloudfront.mixins.CfnDistributionConnectionLogs object>

Static Methods

classmethod is_mixin(x)

Checks if x is a Mixin.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Mixin.