Datasets:
Commit ·
08f8ca2
1
Parent(s): 16e716b
Add human_reference_dataset/aws-cloudformation-templates/CloudWatch/
Browse files- human_reference_dataset/aws-cloudformation-templates/CloudWatch/CloudWatch_Dashboard_ClientVPN.yml +362 -0
- human_reference_dataset/aws-cloudformation-templates/CloudWatch/CloudWatch_Dashboard_NAT_FlowLogs.json +43 -0
- human_reference_dataset/aws-cloudformation-templates/CloudWatch/CloudWatch_Dashboard_NAT_FlowLogs.yaml +32 -0
human_reference_dataset/aws-cloudformation-templates/CloudWatch/CloudWatch_Dashboard_ClientVPN.yml
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AWSTemplateFormatVersion: "2010-09-09"
|
| 2 |
+
Description: >
|
| 3 |
+
This CloudFormation template creates a set of CloudWatch Logs Insights queries and a corresponding dashboard
|
| 4 |
+
for comprehensive AWS Client VPN usage reporting. It provides detailed insights into VPN usage patterns,
|
| 5 |
+
connection durations, data transfer volumes, and user activities across different authentication methods
|
| 6 |
+
(AD/SAML, Mutual Auth, and Mixed Auth).
|
| 7 |
+
|
| 8 |
+
Parameters:
|
| 9 |
+
Folder:
|
| 10 |
+
Type: String
|
| 11 |
+
Default: aws-client-vpn
|
| 12 |
+
AllowedPattern: "^[a-zA-Z0-9/-]*$"
|
| 13 |
+
Description: "(Optional) Folder to store the queries in."
|
| 14 |
+
ConstraintDescription: "Folder name must contain only alphanumeric characters. Slashes (/) are folder separators."
|
| 15 |
+
|
| 16 |
+
ClientVPNLogGroup:
|
| 17 |
+
Type: String
|
| 18 |
+
Default: aws/aws-client-vpn/prod
|
| 19 |
+
Description: "Name of the Client VPN CloudWatch Log Group"
|
| 20 |
+
|
| 21 |
+
Resources:
|
| 22 |
+
TotalUsagePerClientVPNEndpoint:
|
| 23 |
+
Type: AWS::Logs::QueryDefinition
|
| 24 |
+
Properties:
|
| 25 |
+
Name: !Sub "${Folder}/Total Usage per Client VPN Endpoint"
|
| 26 |
+
QueryString: |
|
| 27 |
+
fields @timestamp, `client-vpn-endpoint-id`, `ingress-bytes`, `egress-bytes`, `connection-duration-seconds`, `username`, `common-name`
|
| 28 |
+
| sort @timestamp asc
|
| 29 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 30 |
+
| stats
|
| 31 |
+
count(*) as connection_count,
|
| 32 |
+
min(@timestamp) as earliest_timestamp,
|
| 33 |
+
max(@timestamp) as latest_timestamp,
|
| 34 |
+
sum(`ingress-bytes`)/1048576 as total_ingress_MB,
|
| 35 |
+
sum(`egress-bytes`)/1048576 as total_egress_MB,
|
| 36 |
+
sum((`connection-duration-seconds`/60)/60) as total_connection_time_hours,
|
| 37 |
+
count_distinct(username) as unique_saml_ad_users,
|
| 38 |
+
count_distinct(`common-name`) as unique_mutual_auth_names
|
| 39 |
+
by `client-vpn-endpoint-id`
|
| 40 |
+
| sort by total_ingress_MB desc, total_egress_MB desc
|
| 41 |
+
|
| 42 |
+
ADSAMLAuthTotalUsageReport:
|
| 43 |
+
Type: AWS::Logs::QueryDefinition
|
| 44 |
+
Properties:
|
| 45 |
+
Name: !Sub "${Folder}/AD or SAML Auth Total Usage Report"
|
| 46 |
+
QueryString: |
|
| 47 |
+
fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 48 |
+
| sort @timestamp asc
|
| 49 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 50 |
+
| fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`, (`connection-duration-seconds`/60) as connection_time_minutes
|
| 51 |
+
| sort by `ingress-bytes` desc, `egress-bytes` desc
|
| 52 |
+
|
| 53 |
+
ADSAMLAuthDistinctUsersConnectionDuration:
|
| 54 |
+
Type: AWS::Logs::QueryDefinition
|
| 55 |
+
Properties:
|
| 56 |
+
Name: !Sub "${Folder}/AD or SAML Auth Distinct Users Connection Duration"
|
| 57 |
+
QueryString: |
|
| 58 |
+
fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 59 |
+
| sort @timestamp asc
|
| 60 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 61 |
+
| stats count(*) as connection_count,
|
| 62 |
+
sum(`connection-duration-seconds`/60) as total_connection_time_minutes,
|
| 63 |
+
sum(`ingress-bytes`) as total_ingress_bytes,
|
| 64 |
+
sum(`egress-bytes`) as total_egress_bytes,
|
| 65 |
+
latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id
|
| 66 |
+
by `username`
|
| 67 |
+
| sort by total_ingress_bytes desc, total_egress_bytes desc
|
| 68 |
+
|
| 69 |
+
ADSAMLAuthDistinctUsers:
|
| 70 |
+
Type: AWS::Logs::QueryDefinition
|
| 71 |
+
Properties:
|
| 72 |
+
Name: !Sub "${Folder}/AD or SAML Auth Distinct Users"
|
| 73 |
+
QueryString: |
|
| 74 |
+
fields @timestamp, `client-vpn-endpoint-id`, `username`
|
| 75 |
+
| sort @timestamp asc
|
| 76 |
+
| stats count(*) as connection_count,
|
| 77 |
+
latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id
|
| 78 |
+
by `username`
|
| 79 |
+
|
| 80 |
+
ADSAMLAuthUsersConnectionDuration:
|
| 81 |
+
Type: AWS::Logs::QueryDefinition
|
| 82 |
+
Properties:
|
| 83 |
+
Name: !Sub "${Folder}/AD or SAML Auth Users Connection Duration"
|
| 84 |
+
QueryString: |
|
| 85 |
+
fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 86 |
+
| sort @timestamp asc
|
| 87 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 88 |
+
| stats count(*) as connection_count,
|
| 89 |
+
sum(`connection-duration-seconds`/60) as total_connection_time_minutes
|
| 90 |
+
by `username`
|
| 91 |
+
| sort by total_connection_time_minutes desc
|
| 92 |
+
|
| 93 |
+
MutualAuthTotalUsageReport:
|
| 94 |
+
Type: AWS::Logs::QueryDefinition
|
| 95 |
+
Properties:
|
| 96 |
+
Name: !Sub "${Folder}/Mutual Auth Total Usage Report"
|
| 97 |
+
QueryString: |
|
| 98 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 99 |
+
| sort @timestamp asc
|
| 100 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 101 |
+
| fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`, (`connection-duration-seconds`/60) as connection_time_minutes
|
| 102 |
+
| sort by `ingress-bytes` desc, `egress-bytes` desc
|
| 103 |
+
|
| 104 |
+
MutualAuthDistinctUsersConnectionDuration:
|
| 105 |
+
Type: AWS::Logs::QueryDefinition
|
| 106 |
+
Properties:
|
| 107 |
+
Name: !Sub "${Folder}/Mutual Auth Users Duration"
|
| 108 |
+
QueryString: >
|
| 109 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-duration-seconds`
|
| 110 |
+
| sort @timestamp asc
|
| 111 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 112 |
+
| stats count(*) as connection_count,
|
| 113 |
+
sum(`connection-duration-seconds`/60) as total_connection_time_minutes,
|
| 114 |
+
sum(`ingress-bytes`) as total_ingress_bytes,
|
| 115 |
+
sum(`egress-bytes`) as total_egress_bytes,
|
| 116 |
+
latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id
|
| 117 |
+
by `common-name`
|
| 118 |
+
| sort by total_ingress_bytes desc, total_egress_bytes desc
|
| 119 |
+
|
| 120 |
+
MutualAuthDistinctUsers:
|
| 121 |
+
Type: AWS::Logs::QueryDefinition
|
| 122 |
+
Properties:
|
| 123 |
+
Name: !Sub "${Folder}/Mutual Auth Distinct Users"
|
| 124 |
+
QueryString: |
|
| 125 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`
|
| 126 |
+
| sort @timestamp asc
|
| 127 |
+
| stats count(*) as connection_count, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `common-name`
|
| 128 |
+
|
| 129 |
+
MutualAuthUsersConnectionDuration:
|
| 130 |
+
Type: AWS::Logs::QueryDefinition
|
| 131 |
+
Properties:
|
| 132 |
+
Name: !Sub "${Folder}/Mutual Auth Distinct Users Connection Duration"
|
| 133 |
+
QueryString: |
|
| 134 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` sort @timestamp asc filter `ingress-bytes` > 0 OR `egress-bytes` > 0 stats count(*) as connection_count, sum(`connection-duration-seconds`/60) as total_connection_time_minutes by `common-name`
|
| 135 |
+
|
| 136 |
+
MixAuthTotalUsageReport:
|
| 137 |
+
Type: AWS::Logs::QueryDefinition
|
| 138 |
+
Properties:
|
| 139 |
+
Name: !Sub "${Folder}/Mix Auth Total Usage Report"
|
| 140 |
+
QueryString: |
|
| 141 |
+
fields @timestamp, `client-vpn-endpoint-id`, `username`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 142 |
+
| sort @timestamp asc
|
| 143 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 144 |
+
| fields @timestamp, `client-vpn-endpoint-id`, `username`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`, (`connection-duration-seconds`/60) as connection_time_minutes
|
| 145 |
+
| sort by `ingress-bytes` desc, `egress-bytes` desc
|
| 146 |
+
|
| 147 |
+
MixAuthDistinctUsersConnectionDuration:
|
| 148 |
+
Type: AWS::Logs::QueryDefinition
|
| 149 |
+
Properties:
|
| 150 |
+
Name: !Sub "${Folder}/Mix Auth Distinct Users Connection Duration"
|
| 151 |
+
QueryString: |
|
| 152 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 153 |
+
| sort @timestamp asc
|
| 154 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 155 |
+
| stats count(*) as connection_count,
|
| 156 |
+
sum(`connection-duration-seconds`/60) as total_connection_time_minutes,
|
| 157 |
+
sum(`ingress-bytes`) as total_ingress_bytes,
|
| 158 |
+
sum(`egress-bytes`) as total_egress_bytes,
|
| 159 |
+
latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id
|
| 160 |
+
by `common-name`, `username`
|
| 161 |
+
| sort by total_ingress_bytes desc, total_egress_bytes desc
|
| 162 |
+
|
| 163 |
+
MixAuthDistinctUsers:
|
| 164 |
+
Type: AWS::Logs::QueryDefinition
|
| 165 |
+
Properties:
|
| 166 |
+
Name: !Sub "${Folder}/Mix Auth Distinct Users"
|
| 167 |
+
QueryString: |
|
| 168 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `username`
|
| 169 |
+
| sort @timestamp asc
|
| 170 |
+
| stats count(*) as connection_count,
|
| 171 |
+
latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id
|
| 172 |
+
by `username`, `common-name`
|
| 173 |
+
|
| 174 |
+
MixAuthUsersConnectionDuration:
|
| 175 |
+
Type: AWS::Logs::QueryDefinition
|
| 176 |
+
Properties:
|
| 177 |
+
Name: !Sub "${Folder}/Mix Auth Users Connection Duration"
|
| 178 |
+
QueryString: |
|
| 179 |
+
fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`
|
| 180 |
+
| sort @timestamp asc
|
| 181 |
+
| filter `ingress-bytes` > 0 OR `egress-bytes` > 0
|
| 182 |
+
| stats count(*) as connection_count,
|
| 183 |
+
sum(`connection-duration-seconds`/60) as total_connection_time_minutes
|
| 184 |
+
by `username`, `common-name`
|
| 185 |
+
| sort by total_connection_time_minutes desc
|
| 186 |
+
|
| 187 |
+
Dashboard:
|
| 188 |
+
Type: AWS::CloudWatch::Dashboard
|
| 189 |
+
Properties:
|
| 190 |
+
DashboardName: !Sub "${AWS::Region}-AWS-ClientVPN-Usage-Dashboard"
|
| 191 |
+
DashboardBody:
|
| 192 |
+
Fn::Sub:
|
| 193 |
+
- |
|
| 194 |
+
{
|
| 195 |
+
"widgets": [
|
| 196 |
+
{
|
| 197 |
+
"type": "log",
|
| 198 |
+
"x": 0,
|
| 199 |
+
"y": 0,
|
| 200 |
+
"width": 24,
|
| 201 |
+
"height": 6,
|
| 202 |
+
"properties": {
|
| 203 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `ingress-bytes`, `egress-bytes`, `connection-duration-seconds`, `username`, `common-name` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | stats count(*) as connection_count, min(@timestamp) as earliest_timestamp, max(@timestamp) as latest_timestamp, sum(`ingress-bytes`)/1048576 as total_ingress_MB, sum(`egress-bytes`)/1048576 as total_egress_MB, sum((`connection-duration-seconds`/60)/60) as total_connection_time_hours, count_distinct(username) as unique_saml_ad_users, count_distinct(`common-name`) as unique_mutual_auth_names by `client-vpn-endpoint-id` | sort by total_ingress_MB desc, total_egress_MB desc",
|
| 204 |
+
"region": "${AWS::Region}",
|
| 205 |
+
"title": "Total Usage per Client VPN Endpoint",
|
| 206 |
+
"view": "table"
|
| 207 |
+
}
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"type": "log",
|
| 211 |
+
"x": 0,
|
| 212 |
+
"y": 6,
|
| 213 |
+
"width": 24,
|
| 214 |
+
"height": 6,
|
| 215 |
+
"properties": {
|
| 216 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`, (`connection-duration-seconds`/60) as connection_time_minutes | sort by `ingress-bytes` desc, `egress-bytes` desc",
|
| 217 |
+
"region": "${AWS::Region}",
|
| 218 |
+
"title": "AD or SAML Auth Total Usage Report",
|
| 219 |
+
"view": "table"
|
| 220 |
+
}
|
| 221 |
+
},
|
| 222 |
+
{
|
| 223 |
+
"type": "log",
|
| 224 |
+
"x": 0,
|
| 225 |
+
"y": 12,
|
| 226 |
+
"width": 24,
|
| 227 |
+
"height": 6,
|
| 228 |
+
"properties": {
|
| 229 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | stats count(*) as connection_count, sum(`connection-duration-seconds`/60) as total_connection_time_minutes, sum(`ingress-bytes`) as total_ingress_bytes, sum(`egress-bytes`) as total_egress_bytes, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `username` | sort by total_ingress_bytes desc, total_egress_bytes desc",
|
| 230 |
+
"region": "${AWS::Region}",
|
| 231 |
+
"title": "AD or SAML Auth Distinct Users Connection Duration",
|
| 232 |
+
"view": "table"
|
| 233 |
+
}
|
| 234 |
+
},
|
| 235 |
+
{
|
| 236 |
+
"type": "log",
|
| 237 |
+
"x": 0,
|
| 238 |
+
"y": 18,
|
| 239 |
+
"width": 24,
|
| 240 |
+
"height": 6,
|
| 241 |
+
"properties": {
|
| 242 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `username` | sort @timestamp asc | stats count(*) as connection_count, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `username`",
|
| 243 |
+
"region": "${AWS::Region}",
|
| 244 |
+
"title": "AD or SAML Auth Distinct Users",
|
| 245 |
+
"view": "table"
|
| 246 |
+
}
|
| 247 |
+
},
|
| 248 |
+
{
|
| 249 |
+
"type": "log",
|
| 250 |
+
"x": 0,
|
| 251 |
+
"y": 24,
|
| 252 |
+
"width": 24,
|
| 253 |
+
"height": 6,
|
| 254 |
+
"properties": {
|
| 255 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | stats count(*) as connection_count, sum(`connection-duration-seconds`/60) as total_connection_time_minutes by `username` | sort by total_connection_time_minutes desc",
|
| 256 |
+
"region": "${AWS::Region}",
|
| 257 |
+
"title": "AD or SAML Auth Users Connection Duration",
|
| 258 |
+
"view": "table"
|
| 259 |
+
}
|
| 260 |
+
},
|
| 261 |
+
{
|
| 262 |
+
"type": "log",
|
| 263 |
+
"x": 0,
|
| 264 |
+
"y": 30,
|
| 265 |
+
"width": 24,
|
| 266 |
+
"height": 6,
|
| 267 |
+
"properties": {
|
| 268 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`, (`connection-duration-seconds`/60) as connection_time_minutes | sort by `ingress-bytes` desc, `egress-bytes` desc",
|
| 269 |
+
"region": "${AWS::Region}",
|
| 270 |
+
"title": "Mutual Auth Total Usage Report",
|
| 271 |
+
"view": "table"
|
| 272 |
+
}
|
| 273 |
+
},
|
| 274 |
+
{
|
| 275 |
+
"type": "log",
|
| 276 |
+
"x": 0,
|
| 277 |
+
"y": 36,
|
| 278 |
+
"width": 24,
|
| 279 |
+
"height": 6,
|
| 280 |
+
"properties": {
|
| 281 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | stats count(*) as connection_count, sum(`connection-duration-seconds`/60) as total_connection_time_minutes, sum(`ingress-bytes`) as total_ingress_bytes, sum(`egress-bytes`) as total_egress_bytes, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `common-name` | sort by total_ingress_bytes desc, total_egress_bytes desc",
|
| 282 |
+
"region": "${AWS::Region}",
|
| 283 |
+
"title": "Mutual Auth Users Duration",
|
| 284 |
+
"view": "table"
|
| 285 |
+
}
|
| 286 |
+
},
|
| 287 |
+
{
|
| 288 |
+
"type": "log",
|
| 289 |
+
"x": 0,
|
| 290 |
+
"y": 42,
|
| 291 |
+
"width": 24,
|
| 292 |
+
"height": 6,
|
| 293 |
+
"properties": {
|
| 294 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `common-name` | sort @timestamp asc | stats count(*) as connection_count, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `common-name`",
|
| 295 |
+
"region": "${AWS::Region}",
|
| 296 |
+
"title": "Mutual Auth Distinct Users",
|
| 297 |
+
"view": "table"
|
| 298 |
+
}
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"type": "log",
|
| 302 |
+
"x": 0,
|
| 303 |
+
"y": 48,
|
| 304 |
+
"width": 24,
|
| 305 |
+
"height": 6,
|
| 306 |
+
"properties": {
|
| 307 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `username`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | fields @timestamp, `client-vpn-endpoint-id`, `username`, `common-name`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds`, (`connection-duration-seconds`/60) as connection_time_minutes | sort by `ingress-bytes` desc, `egress-bytes` desc",
|
| 308 |
+
"region": "${AWS::Region}",
|
| 309 |
+
"title": "Mix Auth Total Usage Report",
|
| 310 |
+
"view": "table"
|
| 311 |
+
}
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"type": "log",
|
| 315 |
+
"x": 0,
|
| 316 |
+
"y": 54,
|
| 317 |
+
"width": 24,
|
| 318 |
+
"height": 6,
|
| 319 |
+
"properties": {
|
| 320 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | stats count(*) as connection_count, sum(`connection-duration-seconds`/60) as total_connection_time_minutes, sum(`ingress-bytes`) as total_ingress_bytes, sum(`egress-bytes`) as total_egress_bytes, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `common-name`, `username` | sort by total_ingress_bytes desc, total_egress_bytes desc",
|
| 321 |
+
"region": "${AWS::Region}",
|
| 322 |
+
"title": "Mix Auth Distinct Users Connection Duration",
|
| 323 |
+
"view": "table"
|
| 324 |
+
}
|
| 325 |
+
},
|
| 326 |
+
{
|
| 327 |
+
"type": "log",
|
| 328 |
+
"x": 0,
|
| 329 |
+
"y": 60,
|
| 330 |
+
"width": 24,
|
| 331 |
+
"height": 6,
|
| 332 |
+
"properties": {
|
| 333 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `username` | sort @timestamp asc | stats count(*) as connection_count, latest(`client-vpn-endpoint-id`) as client_vpn_endpoint_id by `username`, `common-name`",
|
| 334 |
+
"region": "${AWS::Region}",
|
| 335 |
+
"title": "Mix Auth Distinct Users",
|
| 336 |
+
"view": "table"
|
| 337 |
+
}
|
| 338 |
+
},
|
| 339 |
+
{
|
| 340 |
+
"type": "log",
|
| 341 |
+
"x": 0,
|
| 342 |
+
"y": 66,
|
| 343 |
+
"width": 24,
|
| 344 |
+
"height": 6,
|
| 345 |
+
"properties": {
|
| 346 |
+
"query": "SOURCE '${ClientVPNLogGroup}' | fields @timestamp, `client-vpn-endpoint-id`, `common-name`, `username`, `ingress-bytes`, `egress-bytes`, `connection-start-time`, `connection-end-time`, `connection-duration-seconds` | sort @timestamp asc | filter `ingress-bytes` > 0 OR `egress-bytes` > 0 | stats count(*) as connection_count, sum(`connection-duration-seconds`/60) as total_connection_time_minutes by `username`, `common-name` | sort by total_connection_time_minutes desc",
|
| 347 |
+
"region": "${AWS::Region}",
|
| 348 |
+
"title": "Mix Auth Users Connection Duration",
|
| 349 |
+
"view": "table"
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
]
|
| 353 |
+
}
|
| 354 |
+
- {}
|
| 355 |
+
|
| 356 |
+
Outputs:
|
| 357 |
+
LogInsightsUrl:
|
| 358 |
+
Value: !Sub "https://${AWS::Region}.console.aws.amazon.com/cloudwatch/home?region=${AWS::Region}#logsV2:logs-insights"
|
| 359 |
+
|
| 360 |
+
DashboardUrl:
|
| 361 |
+
Value: !Sub "https://${AWS::Region}.console.aws.amazon.com/cloudwatch/home?region=${AWS::Region}#dashboards:name=${AWS::Region}-AWS-ClientVPN-Usage-Dashboard"
|
| 362 |
+
Description: "URL to access the created CloudWatch Dashboard for AWS Client VPN Usage"
|
human_reference_dataset/aws-cloudformation-templates/CloudWatch/CloudWatch_Dashboard_NAT_FlowLogs.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"AWSTemplateFormatVersion": "2010-09-09",
|
| 3 |
+
"Description": "Creates a CloudWatch Dashboard with four CloudWatch Logs Insights log widgets that query VPC flow logs for NAT Gateway, related to https://repost.aws/knowledge-center/vpc-find-traffic-sources-nat-gateway",
|
| 4 |
+
"Parameters": {
|
| 5 |
+
"NatGatewayPrivateIP": {
|
| 6 |
+
"Description": "The private IP address of the NAT Gateway",
|
| 7 |
+
"Type": "String"
|
| 8 |
+
},
|
| 9 |
+
"NatGatewayID": {
|
| 10 |
+
"Description": "The ID of the NAT Gateway",
|
| 11 |
+
"Type": "String"
|
| 12 |
+
},
|
| 13 |
+
"VpcCidr": {
|
| 14 |
+
"Description": "The CIDR block of the VPC",
|
| 15 |
+
"Type": "String"
|
| 16 |
+
},
|
| 17 |
+
"LogGroupName": {
|
| 18 |
+
"Description": "The ARN of the log group to query",
|
| 19 |
+
"Type": "String"
|
| 20 |
+
}
|
| 21 |
+
},
|
| 22 |
+
"Resources": {
|
| 23 |
+
"CloudWatchDashboard": {
|
| 24 |
+
"Type": "AWS::CloudWatch::Dashboard",
|
| 25 |
+
"Properties": {
|
| 26 |
+
"DashboardName": {
|
| 27 |
+
"Fn::Sub": "${NatGatewayID}-Traffic-Dashboard"
|
| 28 |
+
},
|
| 29 |
+
"DashboardBody": {
|
| 30 |
+
"Fn::Sub": "{\n \"widgets\": [\n {\n \"type\": \"log\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (dstAddr like '${NatGatewayPrivateIP}' and isIpv4InSubnet(srcAddr, '${VpcCidr}')) | stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Instances sending most traffic through NAT gateway ${NatGatewayID}\", \n \"view\": \"table\"\n }\n },\n {\n \"type\": \"log\",\n \"x\": 12,\n \"y\": 0,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (dstAddr like '${NatGatewayPrivateIP}' and isIpv4InSubnet(srcAddr, '${VpcCidr}')) or (srcAddr like '${NatGatewayPrivateIP}' and isIpv4InSubnet(dstAddr, '${VpcCidr}'))| stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Traffic To and from NAT gateway ${NatGatewayID}\",\n \"view\": \"table\"\n }\n },\n {\n \"type\": \"log\",\n \"x\": 0,\n \"y\": 9,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (srcAddr like '${NatGatewayPrivateIP}' and not isIpv4InSubnet(dstAddr, '${VpcCidr}')) | stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Most often upload communication destinations through NAT Gateway ${NatGatewayID}\",\n \"view\": \"table\"\n }\n },\n {\n \"type\": \"log\",\n \"x\": 12,\n \"y\": 9,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (dstAddr like '${NatGatewayPrivateIP}' and not isIpv4InSubnet(srcAddr, '${VpcCidr}')) | stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Most often download communication destinations through NAT Gateway ${NatGatewayID}\",\n \"view\": \"table\"\n }\n }\n ]\n}\n"
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
},
|
| 35 |
+
"Outputs": {
|
| 36 |
+
"DashboardArn": {
|
| 37 |
+
"Description": "ARN of the created CloudWatch Dashboard",
|
| 38 |
+
"Value": {
|
| 39 |
+
"Ref": "CloudWatchDashboard"
|
| 40 |
+
}
|
| 41 |
+
}
|
| 42 |
+
}
|
| 43 |
+
}
|
human_reference_dataset/aws-cloudformation-templates/CloudWatch/CloudWatch_Dashboard_NAT_FlowLogs.yaml
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
AWSTemplateFormatVersion: "2010-09-09"
|
| 2 |
+
|
| 3 |
+
Description: Creates a CloudWatch Dashboard with four CloudWatch Logs Insights log widgets that query VPC flow logs for NAT Gateway, related to https://repost.aws/knowledge-center/vpc-find-traffic-sources-nat-gateway
|
| 4 |
+
|
| 5 |
+
Resources:
|
| 6 |
+
CloudWatchDashboard:
|
| 7 |
+
Type: AWS::CloudWatch::Dashboard
|
| 8 |
+
Properties:
|
| 9 |
+
DashboardName: !Sub ${NatGatewayID}-Traffic-Dashboard
|
| 10 |
+
DashboardBody: !Sub "{\n \"widgets\": [\n {\n \"type\": \"log\",\n \"x\": 0,\n \"y\": 0,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (dstAddr like '${NatGatewayPrivateIP}' and isIpv4InSubnet(srcAddr, '${VpcCidr}')) | stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Instances sending most traffic through NAT gateway ${NatGatewayID}\", \n \"view\": \"table\"\n }\n },\n {\n \"type\": \"log\",\n \"x\": 12,\n \"y\": 0,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (dstAddr like '${NatGatewayPrivateIP}' and isIpv4InSubnet(srcAddr, '${VpcCidr}')) or (srcAddr like '${NatGatewayPrivateIP}' and isIpv4InSubnet(dstAddr, '${VpcCidr}'))| stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Traffic To and from NAT gateway ${NatGatewayID}\",\n \"view\": \"table\"\n }\n },\n {\n \"type\": \"log\",\n \"x\": 0,\n \"y\": 9,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (srcAddr like '${NatGatewayPrivateIP}' and not isIpv4InSubnet(dstAddr, '${VpcCidr}')) | stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Most often upload communication destinations through NAT Gateway ${NatGatewayID}\",\n \"view\": \"table\"\n }\n },\n {\n \"type\": \"log\",\n \"x\": 12,\n \"y\": 9,\n \"width\": 12,\n \"height\": 9,\n \"properties\": {\n \"query\": \"SOURCE '${LogGroupName}' | fields @timestamp, @message | filter (dstAddr like '${NatGatewayPrivateIP}' and not isIpv4InSubnet(srcAddr, '${VpcCidr}')) | stats sum(bytes) as bytesTransferred by srcAddr, dstAddr | sort bytesTransferred desc | limit 10\",\n \"region\": \"${AWS::Region}\",\n \"stacked\": false,\n \"title\": \"Top 10 - Most often download communication destinations through NAT Gateway ${NatGatewayID}\",\n \"view\": \"table\"\n }\n }\n ]\n}\n"
|
| 11 |
+
|
| 12 |
+
Parameters:
|
| 13 |
+
NatGatewayPrivateIP:
|
| 14 |
+
Type: String
|
| 15 |
+
Description: The private IP address of the NAT Gateway
|
| 16 |
+
|
| 17 |
+
NatGatewayID:
|
| 18 |
+
Type: String
|
| 19 |
+
Description: The ID of the NAT Gateway
|
| 20 |
+
|
| 21 |
+
VpcCidr:
|
| 22 |
+
Type: String
|
| 23 |
+
Description: The CIDR block of the VPC
|
| 24 |
+
|
| 25 |
+
LogGroupName:
|
| 26 |
+
Type: String
|
| 27 |
+
Description: The ARN of the log group to query
|
| 28 |
+
|
| 29 |
+
Outputs:
|
| 30 |
+
DashboardArn:
|
| 31 |
+
Description: ARN of the created CloudWatch Dashboard
|
| 32 |
+
Value: !Ref CloudWatchDashboard
|