2 Answers
- Newest
- Most votes
- Most comments
3
Hello.
I think it will work if you set the template as follows.
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-monitoringsubscription.html
Resources:
AssetsDomainCDN:
Type: AWS::CloudFront::Distribution
DeletionPolicy: Retain
Properties:
DistributionConfig:
PriceClass: PriceClass_100
Origins:
- DomainName: "bar.foo.com"
Id: "bar.foo.com"
CustomOriginConfig:
HTTPPort: 80
HTTPSPort: 443
OriginProtocolPolicy: match-viewer
OriginSSLProtocols:
- TLSv1.1
Enabled: true
HttpVersion: http2
DefaultCacheBehavior:
AllowedMethods: [GET, HEAD]
TargetOriginId: bar.foo.com
Compress: true
ViewerProtocolPolicy: allow-all
ForwardedValues:
Cookies:
Forward: none
Headers: []
QueryString: false
MonitoringSubscription:
Type: AWS::CloudFront::MonitoringSubscription
Properties:
DistributionId: !Ref AssetsDomainCDN
MonitoringSubscription:
RealtimeMetricsSubscriptionConfig:
RealtimeMetricsSubscriptionStatus: Enabled
Relevant content
- asked 3 years ago
- AWS OFFICIALUpdated 18 days ago

Ah I didn't realize I needed to add a new section. Thanks.