-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing OriginShieldProperty in cloudfront.distribution #12872
Comments
Origin shield support has not yet been added to either Contributions welcome! In the mean time, you can use escape hatch raw overrides to set the properties. For example: const cfnDist = dist.node.defaultChild as CfnDistribution;
cfnDist.addPropertyOverride('DistributionConfig.Origins.0.OriginShield', {
Enabled: true,
OriginShieldRegion: 'us-east-2',
}); |
@njlynch Thanks for the response! I'll take a look at contributing to getting this into cf.distribution. In the meantime here is approach I was looking at (from https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.CfnDistribution.OriginShieldProperty.html):
I haven't tested the above yet, and the docs aren't clear if originShield should be under distributionConfig, or under origin like so:
Would either of these work & simply be another way to do approach this? |
@njlynch Wanted to circle back here to close the loop if others were looking for possible solutions to this issue. I was able to get this to work with CfnDistribution, specifically within distributionConfig:
FWIW, even with these issues, I'm loving CDK. |
**Closes [#12872](#12872 - Origin Shield is a part of the CfnDistribution resources but has not yet been added to the relevant CloudFront constructs. These changes add `originShieldRegion` fields to `OriginProps` and `SourceConfiguration` as specified [here](#12872 (comment)) as well as update the ReadMe and all the necessary tests. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
**Closes [aws#12872](aws#12872 - Origin Shield is a part of the CfnDistribution resources but has not yet been added to the relevant CloudFront constructs. These changes add `originShieldRegion` fields to `OriginProps` and `SourceConfiguration` as specified [here](aws#12872 (comment)) as well as update the ReadMe and all the necessary tests. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
**Closes [aws#12872](aws#12872 - Origin Shield is a part of the CfnDistribution resources but has not yet been added to the relevant CloudFront constructs. These changes add `originShieldRegion` fields to `OriginProps` and `SourceConfiguration` as specified [here](aws#12872 (comment)) as well as update the ReadMe and all the necessary tests. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-cloudfront.CfnDistribution.OriginShieldProperty.html
I am trying to add OriginShielding to a Cloudfront Distribution via CDK and the docs are very unclear about the approach.
To access origin shield within CDK you have to call cfnDistribution, however that doesn't appear to be compatible with the cloudfront distribution construct, nor cloudfront-origins.
Do I need to use cfnDistribution for the whole distribution?
It would be very helpful to have more thorough examples of a Cloudfront Distribution setup, especially after deprecating CloudFrontWebDistribution.
The text was updated successfully, but these errors were encountered: