Skip to content

Instantly share code, notes, and snippets.

View spbriggs's full-sized avatar

Simon spbriggs

  • United Kingdom
View GitHub Profile
@spbriggs
spbriggs / aws-cheapest.php
Created August 31, 2016 07:38
PHP script to scrape spot instance pricing data from Amazon AWS and display cheapest region for each instance tyoe
<?php
// Copyright Simon Briggs 2016
// Licensed under the Gnu Lesser General Public License
// https://www.gnu.org/licenses/lgpl.txt
// Get pricing data from Amazon
// (For better performance get the data and cache it with a cron job)
$data = file_get_contents("https://spot-price.s3.amazonaws.com/spot.js");
// Trim off the JSONP function to give us propert JSON
$data = substr($data, 9, strlen($data)-10);