Skip to content

Commit 95d187e

Browse files
feat(cloudfront): additional cloudfront distribution metrics (#28777)
This PR supports the activation of [additional cloudfront distribution metrics](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/viewing-cloudfront-metrics.html#monitoring-console.distributions-additional). ```ts new cloudfront.Distribution(this, 'myDist', { defaultBehavior: { origin: new origins.HttpOrigin('www.example.com') }, publishAdditionalMetrics: true, // added }); ``` Closes #22922. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c17dbde commit 95d187e

File tree

12 files changed

+1273
-1
lines changed

12 files changed

+1273
-1
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-additional-metrics.js.snapshot/MyTestDefaultTestDeployAssertB8AA280E.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-additional-metrics.js.snapshot/MyTestDefaultTestDeployAssertB8AA280E.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-additional-metrics.js.snapshot/MyTestStack.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
{
2+
"Resources": {
3+
"DistB3B78991": {
4+
"Type": "AWS::CloudFront::Distribution",
5+
"Properties": {
6+
"DistributionConfig": {
7+
"DefaultCacheBehavior": {
8+
"CachePolicyId": "658327ea-f89d-4fab-a63d-7e88639e58f6",
9+
"Compress": true,
10+
"TargetOriginId": "MyTestStackDistOrigin1CBA48A7B",
11+
"ViewerProtocolPolicy": "allow-all"
12+
},
13+
"Enabled": true,
14+
"HttpVersion": "http2",
15+
"IPV6Enabled": true,
16+
"Origins": [
17+
{
18+
"CustomOriginConfig": {
19+
"OriginProtocolPolicy": "https-only"
20+
},
21+
"DomainName": "www.example.com",
22+
"Id": "MyTestStackDistOrigin1CBA48A7B"
23+
}
24+
]
25+
}
26+
}
27+
},
28+
"DistMonitoringSubscriptionDD7607C2": {
29+
"Type": "AWS::CloudFront::MonitoringSubscription",
30+
"Properties": {
31+
"DistributionId": {
32+
"Ref": "DistB3B78991"
33+
},
34+
"MonitoringSubscription": {
35+
"RealtimeMetricsSubscriptionConfig": {
36+
"RealtimeMetricsSubscriptionStatus": "Enabled"
37+
}
38+
}
39+
}
40+
},
41+
"Alarm1F9009D71": {
42+
"Type": "AWS::CloudWatch::Alarm",
43+
"Properties": {
44+
"ComparisonOperator": "GreaterThanThreshold",
45+
"Dimensions": [
46+
{
47+
"Name": "DistributionId",
48+
"Value": {
49+
"Ref": "DistB3B78991"
50+
}
51+
}
52+
],
53+
"EvaluationPeriods": 1,
54+
"MetricName": "OriginLatency",
55+
"Namespace": "AWS/CloudFront",
56+
"Period": 300,
57+
"Statistic": "Average",
58+
"Threshold": 1
59+
}
60+
},
61+
"Alarm2A7122E13": {
62+
"Type": "AWS::CloudWatch::Alarm",
63+
"Properties": {
64+
"ComparisonOperator": "GreaterThanThreshold",
65+
"Dimensions": [
66+
{
67+
"Name": "DistributionId",
68+
"Value": {
69+
"Ref": "DistB3B78991"
70+
}
71+
}
72+
],
73+
"EvaluationPeriods": 1,
74+
"MetricName": "CacheHitRate",
75+
"Namespace": "AWS/CloudFront",
76+
"Period": 300,
77+
"Statistic": "Average",
78+
"Threshold": 1
79+
}
80+
},
81+
"Alarm32341D8D9": {
82+
"Type": "AWS::CloudWatch::Alarm",
83+
"Properties": {
84+
"ComparisonOperator": "GreaterThanThreshold",
85+
"Dimensions": [
86+
{
87+
"Name": "DistributionId",
88+
"Value": {
89+
"Ref": "DistB3B78991"
90+
}
91+
}
92+
],
93+
"EvaluationPeriods": 1,
94+
"MetricName": "401ErrorRate",
95+
"Namespace": "AWS/CloudFront",
96+
"Period": 300,
97+
"Statistic": "Average",
98+
"Threshold": 1
99+
}
100+
},
101+
"Alarm4671832C8": {
102+
"Type": "AWS::CloudWatch::Alarm",
103+
"Properties": {
104+
"ComparisonOperator": "GreaterThanThreshold",
105+
"Dimensions": [
106+
{
107+
"Name": "DistributionId",
108+
"Value": {
109+
"Ref": "DistB3B78991"
110+
}
111+
}
112+
],
113+
"EvaluationPeriods": 1,
114+
"MetricName": "403ErrorRate",
115+
"Namespace": "AWS/CloudFront",
116+
"Period": 300,
117+
"Statistic": "Average",
118+
"Threshold": 1
119+
}
120+
},
121+
"Alarm548383B2F": {
122+
"Type": "AWS::CloudWatch::Alarm",
123+
"Properties": {
124+
"ComparisonOperator": "GreaterThanThreshold",
125+
"Dimensions": [
126+
{
127+
"Name": "DistributionId",
128+
"Value": {
129+
"Ref": "DistB3B78991"
130+
}
131+
}
132+
],
133+
"EvaluationPeriods": 1,
134+
"MetricName": "404ErrorRate",
135+
"Namespace": "AWS/CloudFront",
136+
"Period": 300,
137+
"Statistic": "Average",
138+
"Threshold": 1
139+
}
140+
},
141+
"Alarm65738D89F": {
142+
"Type": "AWS::CloudWatch::Alarm",
143+
"Properties": {
144+
"ComparisonOperator": "GreaterThanThreshold",
145+
"Dimensions": [
146+
{
147+
"Name": "DistributionId",
148+
"Value": {
149+
"Ref": "DistB3B78991"
150+
}
151+
}
152+
],
153+
"EvaluationPeriods": 1,
154+
"MetricName": "502ErrorRate",
155+
"Namespace": "AWS/CloudFront",
156+
"Period": 300,
157+
"Statistic": "Average",
158+
"Threshold": 1
159+
}
160+
},
161+
"Alarm77B1024B6": {
162+
"Type": "AWS::CloudWatch::Alarm",
163+
"Properties": {
164+
"ComparisonOperator": "GreaterThanThreshold",
165+
"Dimensions": [
166+
{
167+
"Name": "DistributionId",
168+
"Value": {
169+
"Ref": "DistB3B78991"
170+
}
171+
}
172+
],
173+
"EvaluationPeriods": 1,
174+
"MetricName": "503ErrorRate",
175+
"Namespace": "AWS/CloudFront",
176+
"Period": 300,
177+
"Statistic": "Average",
178+
"Threshold": 1
179+
}
180+
},
181+
"Alarm8AEE8034F": {
182+
"Type": "AWS::CloudWatch::Alarm",
183+
"Properties": {
184+
"ComparisonOperator": "GreaterThanThreshold",
185+
"Dimensions": [
186+
{
187+
"Name": "DistributionId",
188+
"Value": {
189+
"Ref": "DistB3B78991"
190+
}
191+
}
192+
],
193+
"EvaluationPeriods": 1,
194+
"MetricName": "504ErrorRate",
195+
"Namespace": "AWS/CloudFront",
196+
"Period": 300,
197+
"Statistic": "Average",
198+
"Threshold": 1
199+
}
200+
}
201+
},
202+
"Parameters": {
203+
"BootstrapVersion": {
204+
"Type": "AWS::SSM::Parameter::Value<String>",
205+
"Default": "/cdk-bootstrap/hnb659fds/version",
206+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
207+
}
208+
},
209+
"Rules": {
210+
"CheckBootstrapVersion": {
211+
"Assertions": [
212+
{
213+
"Assert": {
214+
"Fn::Not": [
215+
{
216+
"Fn::Contains": [
217+
[
218+
"1",
219+
"2",
220+
"3",
221+
"4",
222+
"5"
223+
],
224+
{
225+
"Ref": "BootstrapVersion"
226+
}
227+
]
228+
}
229+
]
230+
},
231+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
232+
}
233+
]
234+
}
235+
}
236+
}

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-additional-metrics.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-cloudfront/test/integ.distribution-additional-metrics.js.snapshot/integ.json

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)