Skip to content

Instantly share code, notes, and snippets.

@mca-gif
Created September 16, 2020 19:32
Show Gist options
  • Save mca-gif/29afce50d57314cdc2e963e4901ccfa3 to your computer and use it in GitHub Desktop.
Save mca-gif/29afce50d57314cdc2e963e4901ccfa3 to your computer and use it in GitHub Desktop.
AWS - Discover Down VPN Connections
# 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