Metadata-Version: 2.1
Name: aws-cdk.aws-cloudfront-origins
Version: 1.92.0
Summary: The CDK Construct Library for AWS CloudFront Origins
Home-page: https://github.com/aws/aws-cdk
Author: Amazon Web Services
License: Apache-2.0
Project-URL: Source, https://github.com/aws/aws-cdk.git
Description: # CloudFront Origins for the CDK CloudFront Library
        
        <!--BEGIN STABILITY BANNER-->---
        
        
        ![cdk-constructs: Stable](https://img.shields.io/badge/cdk--constructs-stable-success.svg?style=for-the-badge)
        
        ---
        <!--END STABILITY BANNER-->
        
        This library contains convenience methods for defining origins for a CloudFront distribution. You can use this library to create origins from
        S3 buckets, Elastic Load Balancing v2 load balancers, or any other domain name.
        
        ## S3 Bucket
        
        An S3 bucket can be added as an origin. If the bucket is configured as a website endpoint, the distribution can use S3 redirects and S3 custom error
        documents.
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        import aws_cdk.aws_cloudfront as cloudfront
        import aws_cdk.aws_cloudfront_origins as origins
        
        my_bucket = s3.Bucket(self, "myBucket")
        cloudfront.Distribution(self, "myDist",
            default_behavior=BehaviorOptions(origin=origins.S3Origin(my_bucket))
        )
        ```
        
        The above will treat the bucket differently based on if `IBucket.isWebsite` is set or not. If the bucket is configured as a website, the bucket is
        treated as an HTTP origin, and the built-in S3 redirects and error pages can be used. Otherwise, the bucket is handled as a bucket origin and
        CloudFront's redirect and error handling will be used. In the latter case, the Origin will create an origin access identity and grant it access to the
        underlying bucket. This can be used in conjunction with a bucket that is not public to require that your users access your content using CloudFront
        URLs and not S3 URLs directly. Alternatively, a custom origin access identity can be passed to the S3 origin in the properties.
        
        ## ELBv2 Load Balancer
        
        An Elastic Load Balancing (ELB) v2 load balancer may be used as an origin. In order for a load balancer to serve as an origin, it must be publicly
        accessible (`internetFacing` is true). Both Application and Network load balancers are supported.
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        import aws_cdk.aws_ec2 as ec2
        import aws_cdk.aws_elasticloadbalancingv2 as elbv2
        
        vpc = ec2.Vpc(...)
        # Create an application load balancer in a VPC. 'internetFacing' must be 'true'
        # for CloudFront to access the load balancer and use it as an origin.
        lb = elbv2.ApplicationLoadBalancer(self, "LB",
            vpc=vpc,
            internet_facing=True
        )
        cloudfront.Distribution(self, "myDist",
            default_behavior={"origin": origins.LoadBalancerV2Origin(lb)}
        )
        ```
        
        The origin can also be customized to respond on different ports, have different connection properties, etc.
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        origin = origins.LoadBalancerV2Origin(load_balancer,
            connection_attempts=3,
            connection_timeout=Duration.seconds(5),
            protocol_policy=cloudfront.OriginProtocolPolicy.MATCH_VIEWER
        )
        ```
        
        ## From an HTTP endpoint
        
        Origins can also be created from any other HTTP endpoint, given the domain name, and optionally, other origin properties.
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        cloudfront.Distribution(self, "myDist",
            default_behavior={"origin": origins.HttpOrigin("www.example.com")}
        )
        ```
        
        See the documentation of `@aws-cdk/aws-cloudfront` for more information.
        
        ## Failover Origins (Origin Groups)
        
        You can set up CloudFront with origin failover for scenarios that require high availability.
        To get started, you create an origin group with two origins: a primary and a secondary.
        If the primary origin is unavailable, or returns specific HTTP response status codes that indicate a failure,
        CloudFront automatically switches to the secondary origin.
        You achieve that behavior in the CDK using the `OriginGroup` class:
        
        ```python
        # Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
        cloudfront.Distribution(self, "myDist",
            default_behavior={
                "origin": origins.OriginGroup(
                    primary_origin=origins.S3Origin(my_bucket),
                    fallback_origin=origins.HttpOrigin("www.example.com"),
                    # optional, defaults to: 500, 502, 503 and 504
                    fallback_status_codes=[404]
                )
            }
        )
        ```
        
Platform: UNKNOWN
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: JavaScript
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Typing :: Typed
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved
Classifier: Framework :: AWS CDK
Classifier: Framework :: AWS CDK :: 1
Requires-Python: >=3.6
Description-Content-Type: text/markdown
