Created
September 16, 2020 19:32
-
-
Save mca-gif/29afce50d57314cdc2e963e4901ccfa3 to your computer and use it in GitHub Desktop.
AWS - Discover Down VPN Connections
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all of the VPN connections on an account where both tunnels are in a DOWN state. | |
# CSV format | |
aws ec2 describe-vpn-connections | jq -r '.VpnConnections[] | select ((.VgwTelemetry[0].Status == "DOWN") and (.VgwTelemetry[1].Status == "DOWN")) | [(.Tags[] | select(.Key == "Name") | .Value), .VpnConnectionId, .CustomerGatewayId, .VgwTelemetry[].LastStatusChange] | @csv' | |
# JSON format for additional processing | |
aws ec2 describe-vpn-connections | jq -r '.VpnConnections[] | select ((.VgwTelemetry[0].Status == "DOWN") and (.VgwTelemetry[1].Status == "DOWN")) | { Name: (.Tags[] | select(.Key == "Name") | .Value), VpnConnectionId: .VpnConnectionId, CustomerGatewayId: .CustomerGatewayId, LastStatusChange0: .VgwTelemetry[0].LastStatusChange, LastStatusChange1: .VgwTelemetry[1].LastStatusChange}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment