Skip to content

Latest commit

 

History

History
31 lines (19 loc) · 801 Bytes

README.md

File metadata and controls

31 lines (19 loc) · 801 Bytes

AWS Blocker

This simple bash script will retrieve the official list of AWS IPv4 and IPv6 ranges, then block them all using iptables.

The script is safe to run multiple times. The AWS IP range list is updated periodically, so you may want to run this script as a cron.

Requirements

You'll need jq to parse the JSON. This package is readily available in most Linux package managers.

Usage

Usage: aws-blocker [POSITION] [REGIONS]...

Position is a nummeric value specifying the line number the INPUT chain target line will be inserted at. Defaults to 1. Without any region arguments all IP ranges will by used.

Example:

aws-blocker 3 ap-southeast sa-east

Instead of downloading a file on each run you can also redirect a file input:

aws-blocker < ranges.json