forked from aws-cloudformation/aws-cloudformation-macros
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacro.template
78 lines (72 loc) · 2.17 KB
/
macro.template
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
Transform: AWS::Serverless-2016-10-31
Resources:
ResourceFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.6
CodeUri: lambda
Handler: resource.handler
Policies: CloudWatchFullAccess
MacroFunction:
Type: AWS::Serverless::Function
Properties:
Runtime: python3.6
CodeUri: lambda
Handler: index.handler
Macro:
Type: AWS::CloudFormation::Macro
Properties:
Name: StackMetrics
FunctionName: !GetAtt MacroFunction.Arn
Dashboard:
Type: AWS::CloudWatch::Dashboard
Properties:
DashboardName: CloudFormation-Stacks
DashboardBody: |
{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 12,
"height": 12,
"properties": {
"view": "timeSeries",
"stacked": false,
"metrics": [
[ "CloudFormation", "ResourceCount" ]
],
"region": "eu-west-1",
"title": "Resources created",
"period": 300,
"stat": "Sum"
}
},
{
"type": "metric",
"x": 12,
"y": 0,
"width": 12,
"height": 12,
"properties": {
"view": "timeSeries",
"stacked": true,
"title": "Stack operations",
"metrics": [
[ "CloudFormation", "Create" ],
[ ".", "Delete" ],
[ ".", "Update" ]
],
"region": "eu-west-1",
"period": 300,
"stat": "Sum"
}
}
]
}
Outputs:
ResourceFunction:
Value: !GetAtt ResourceFunction.Arn
Export:
Name: StackMetricsMacroFunction