Skip to content

Instantly share code, notes, and snippets.

@SupaMic
Created February 7, 2019 00:41
Show Gist options
  • Save SupaMic/ffd09d35ed09312472fb1d2720a2311b to your computer and use it in GitHub Desktop.
Save SupaMic/ffd09d35ed09312472fb1d2720a2311b to your computer and use it in GitHub Desktop.
Get the AWS IP Ranges for Cloud9 Servers which are needed to set inbound rules when connecting to outside servers by SSH
/* Might need to go to https://aws.amazon.com/ or use blank page to run */
var arr=[];
var oReq = new XMLHttpRequest();
oReq.addEventListener("load", reqListener);
oReq.open("GET", "https://ip-ranges.amazonaws.com/ip-ranges.json");
oReq.send();
function reqListener () {
JSON.parse(this.responseText).prefixes.map(function(obj){
if(obj.service == 'CLOUD9'){
arr.push(obj.ip_prefix)
}
})
console.log(arr.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment