{"id":20980,"library":"awsipranges","title":"AWS IP Ranges","description":"AWS IP Ranges is a Python library for working with AWS IP address ranges natively. It provides tools to download, parse, and query the AWS IP address ranges JSON data (from https://ip-ranges.amazonaws.com/ip-ranges.json). Current version is 0.3.3, released periodically.","status":"active","version":"0.3.3","language":"python","source_language":"en","source_url":"https://github.com/aws-samples/awsipranges","tags":["aws","ip-ranges","cloud","networking"],"install":[{"cmd":"pip install awsipranges","lang":"bash","label":"pip install"}],"dependencies":[{"reason":"HTTP client for downloading the JSON data","package":"requests","optional":false}],"imports":[{"note":"The main class to download and parse the IP ranges.","wrong":"","symbol":"AWSIPPrefixes","correct":"from awsipranges import AWSIPPrefixes"}],"quickstart":{"code":"from awsipranges import AWSIPPrefixes\n\n# Download current AWS IP ranges\nprefixes = AWSIPPrefixes()\nprefixes.download()\n\n# Filter for us-east-1 region, EC2 service\nec2_us_east1 = prefixes.filter(regions=['us-east-1'], services=['EC2'])\nprint(f\"Found {len(ec2_us_east1)} prefixes for EC2 in us-east-1\")\n\n# Access the MD5 hash (available since 0.3.0)\nprint(f\"MD5 hash: {prefixes.md5}\")","lang":"python","description":"Download the AWS IP ranges JSON and filter by region and service."},"warnings":[{"fix":"Store the result in a variable and iterate over it directly.","message":"The filter() method returns a list of IP prefixes, not an AWSIPPrefixes object. Do not attempt to chain further filter calls.","severity":"gotcha","affected_versions":"all"},{"fix":"Replace `prefixes.sync()` with `prefixes.download()`.","message":"The `sync()` method is deprecated. Use `download()` instead.","severity":"deprecated","affected_versions":">=0.3.0"},{"fix":"Ensure your Python version is in the supported range (3.7-3.11 tested).","message":"The library requires Python >=3.7,<4.0. Using Python 3.6 or 4.0+ will cause install failures.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `from awsipranges import AWSIPPrefixes`.","cause":"Importing incorrectly (e.g., `import awsipranges` and then `awsipranges.AWSIPPrefixes` without the class import), or package not installed.","error":"NameError: name 'AWSIPPrefixes' is not defined"},{"fix":"Ensure the machine has internet access and can reach https://ip-ranges.amazonaws.com/. Alternatively, use a proxy with the `proxies` parameter.","cause":"No internet access or the AWS IP ranges endpoint is unreachable (e.g., due to firewall or network issues).","error":"requests.exceptions.ConnectionError: HTTPSConnectionPool(host='ip-ranges.amazonaws.com', port=443): Max retries exceeded"},{"fix":"Do not chain filters. Instead, save the first result and apply a second filter manually: `result = prefixes.filter(...); second = [p for p in result if ...]`.","cause":"Calling `filter()` on the result of a previous `filter()` call, but `filter()` returns a list.","error":"AttributeError: 'list' object has no attribute 'filter'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}