Skip to content

Instantly share code, notes, and snippets.

@stephenrichards
Created November 16, 2016 15:26
Show Gist options
  • Save stephenrichards/1d53c9b19f08ee9ef8b0ec842d4fec3f to your computer and use it in GitHub Desktop.
Save stephenrichards/1d53c9b19f08ee9ef8b0ec842d4fec3f to your computer and use it in GitHub Desktop.
require 'rest-client'
require 'ap'
response = RestClient.get 'https://ip-ranges.amazonaws.com/ip-ranges.json', accept: :json
hash = JSON.parse(response.body)
regions = hash['prefixes']
ranges = []
regions.each do |region|
ranges << region['ip_prefix'] if region['region'] == 'eu-west-1'
end
ap ranges
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment