IT notes

get the Primary IP

To get the primary IP in Linux: ip route get 1 | awk '{print $NF;exit}' In awk NF return the number of fields and by suffixing it with $ is like doing print $7 In macOS, to list all your interfaces: networksetup -listallhardwareports If want to get the IP assigned to the Wi-FI: ipconfig getifaddr $(networksetup -listallhardwareports | awk '/Hardware Port: Wi-Fi/{getline; print $2}')

AWS Policy Access by IP

Policy to restrict IAM AWS API requests to a specific set of IP addresses. { "Version": "2012-10-17", "Statement": { "Effect": "Deny", "Action": "*", "Resource": "*", "Condition": { "NotIpAddress": { "aws:SourceIp": [ "", "", "" ] } } } } After applying this policy others may need to be applied or in case all in one required, something like this can be used: { "Version": "2012-10-17", "Statement": [{ "Effect": "Deny", "Action": "*", "Resource": "*", "Condition": { "NotIpAddress": { "aws:SourceIp": [ "10.