Comment puis-je l'utiliser dans un modèle ? Je n'ai trouvé aucun exemple : * https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-distributionconfig.html#cfn-cloudfront-distribution-distributionconfig-cachebehaviors * https://docs.amazonaws.cn/en_us/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-distribution-cachebehavior.html
J'ai défini un DefaultCacheBehavior et je veux maintenant ajouter des comportements supplémentaires.
J'ai essayé mais j'obtiens une erreur :
.....
CFDistribution:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Enabled: 'true'
Comment: 'sdlkfjsdlkfjsldkfj'
PriceClass: 'PriceClass_All'
IPV6Enabled: true
DefaultRootObject: index.html
Origins:
-
Id: Origin01 # arbitrary identifier
S3OriginConfig: {}
DomainName: 'mydomain.blhblhb.blhb.com'
ViewerCertificate:
AcmCertificateArn: 'my-cer-id'
SslSupportMethod: sni-only
DefaultCacheBehavior:
TargetOriginId: Origin01
ViewerProtocolPolicy: redirect-to-https
Compress: true
MinTTL: 0
DefaultTTL: 3600
MaxTTL: 31536000
AllowedMethods:
- GET
- HEAD
CachedMethods:
- GET
- HEAD
ForwardedValues:
QueryString: 'false'
Headers:
- Origin
- CloudFront-Viewer-Country
Cookies:
Forward: none
# Tried adding this but no workie
CacheBehaviors:
CacheBehavior:
PathPattern: '/somepath/*'
TargetOriginId: Origin01
ViewerProtocolPolicy: redirect-to-https
Compress: true
MinTTL: 0
DefaultTTL: 3600
MaxTTL: 31536000
AllowedMethods:
- GET
- HEAD
CachedMethods:
- GET
- HEAD
ForwardedValues:
QueryString: 'false'
Headers:
- Origin
- CloudFront-Viewer-Country
Cookies:
Forward: none
LambdaFunctionAssociations:
-
EventType: origin-request
LambdaFunctionARN: !Ref MyLambda.Version
Je reçois une erreur :
Property validation failure: [Value of property {/DistributionConfig/CacheBehaviors} does not match type {Array}]