AWS::CloudFront::Distribution CacheBehavior : independant resource
Possibility of reducing the size of AWS::CloudFront::Distribution DistributionConfig property by leaving the object AWS::CloudFront::Distribution CacheBehavior as an independant resource
help !?
see AWS::CloudFront::CachePolicy and/or AWS::CloudFront::OriginRequestPolicy
I'm speaking about CacheBehavior as an independant resources not about cachePolicy & OriginRequestPolicy !
A CloudFormartion resource usually wraps existing API calls to create, read, update, delete, and list a resource. This doesn't work for all APIs (not all resources have a list or even a create) but for the most part that is the idea. The problem I'm seeing with this request is that there are no APIs for creating, update, or deleting a cache behavior. Its embedded into the distribution config for the API calls. https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_DistributionConfig.html
If I understand this request correctly you are looking to reduce the distribution config section to the CloudFront API. CloudFormation could model around those APIs if they existed.
If I understand this request correctly you are looking to reduce the distribution config section to the CloudFront API. CloudFormation could model around those APIs if they existed
Like @therealsebo mentioned, using the (new) AWS::CloudFront::CachePolicy and/or AWS::CloudFront::OriginRequestPolicy can also reduce the size of the DistributionConfig, and makes it easier to share policies between distributions. They can slightly change the behaviour of CloudFront, so it's not always a drop-in replacement.
For distributions where the configuration can't be changed to use those, CloudFormation could consider supporting yaml anchors or constants to help reduce template size (in a lot of case there is plenty of repetiton between CacheBehaviours)