Mr.9715
06/13/2021, 10:44 AMconst distribution = cloudfront.Distribution.fromDistributionAttributes(this, name('cdn'), {
distributionId: cdk.Fn.getAtt(name('distName'), 'app1devDistID'),
domainName: siteDomain
});
The above code works but this distribution
object doesn't have any methods. only a few properties.Mr.9715
06/13/2021, 10:46 AMMr.9715
06/13/2021, 10:50 AMFrank
bucket1
as the defaultBehavior
, and add bucket2
as an additionalBehavior
Frank
Frank
new cloudfront.Distribution(this, 'myDist', {
defaultBehavior: {
origin: bucket1Origin,
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
},
additionalBehaviors: {
'/admin': {
origin: bucket2Origin,
viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
},
},
});
Mr.9715
06/14/2021, 4:07 AM.addBehavior()
might work, I will try and let you know.Mr.9715
06/14/2021, 7:20 AMMr.9715
06/14/2021, 7:25 AMFrank
bucket2
is imported to the stack that’s creating the Distribution? So you aren’t importing the Distribution.Mr.9715
06/14/2021, 7:42 AM