Skip to content

Not able to import S3BucketOrigin from aws_cdk.aws_cloudfront_origins when using Python cdk api #31757

Answered by khushail
nikhil-salodkar asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @nikhil-salodkar , I tried to deploy the shared code with this configuration and it was deployed successfully-

requirements.txt file-

aws-cdk-lib==2.162.1
constructs>=10.0.0,<11.0.0

Code -

from aws_cdk import (
    # Duration,
    Stack,
    # aws_sqs as sqs,
    aws_s3 as s3,
    aws_cloudfront as cloudfront,
    aws_cloudfront_origins as origins
)
from constructs import Construct

class S3BucketOriginStack(Stack):

    def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
        super().__init__(scope, construct_id, **kwargs)

        my_bucket = s3.Bucket(self, "myBucket") 
        cloudfront.Distribution(self, "myDist", 
            default_behavior=cloudfront.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by nikhil-salodkar
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants