AWS Status Hotline via Twilio
Time to read: 2 minutes
December 16, 2008
Written by
I was chatting yesterday with Jeff Barr, AWS evangelist extraordinaire and all-around great guy yesterday.
He had the idea of building an Amazon Web Services Status hotline, allowing AWS customers to call in and instantly get the status of S3, EC2, etc. Cool idea! AWS already maintains a status dashboard (with RSS feeds!) at: http://status.aws.amazon.com
About 10 minutes later, we had a finished status hotline! Try it out, give a call to:
(206) 866-5918
Building it was quite simple. First, I grabbed a Seattle (206) phone number from Twilio:
and pointed it toward my application URL:
Feel free to click that link, you’ll see the TwiML in your browser!
When a digit is pressed, it submits to handleStatus2.php. This script fetches HTML from status.aws.amazon.com and parses the file using a regular expression to find the status for the desired service.
This script first looks at the digit that was pressed, and figures out which service it represents, or redirects back to the initial page (index.php) with an error flag set, telling the caller that the digit was not valid. Because I’m using Amazon’s HTML page, I set a regular expression to match in finding each service’s status. Amazon returns an HTML table with the services’ statuses, so I can just match on a containing the name of the service, and the next contains the service status:
At this point, you may be screaming… just use the RSS feeds! I couldn’t get Amazon’s RSS feeds to work, I’ll tell you why in a bit.
So once we have the regex set, the script fetches HTML from http://status.aws.amazon.com, and uses preg_match to find the service status line based on the regex:
One we have the service and status strings, let’s output some TwiML to read the status to the caller:
That’s it!
Note that if no status was found, because the regex failed, then I read an error message. After the status is read, I use the verb to send the caller back to the main menu at index.php.
You may have noticed handleStatus2.php? What happened to handleStatus.php? Good question, that was my initial attempt to use Amazon’s RSS feeds to get the current status.
On the status.aws.amazon.com page, you’ll see a list of RSS feeds, one for each service:
When I open those feeds in my reader, I get a single entry reporting the status:
Here’s what I get back:
So it seems we have a case of a missing block?!?
I don’t know if RSS readers send some double-secret HTTP headers or what, but hopefully AWS can figure out why their RSS feeds don’t return the status when fetched via PHP.
Related Posts
Related Resources
Twilio Docs
From APIs to SDKs to sample apps
API reference documentation, SDKs, helper libraries, quickstarts, and tutorials for your language and platform.
Resource Center
The latest ebooks, industry reports, and webinars
Learn from customer engagement experts to improve your own communication.
Ahoy
Twilio's developer community hub
Best practices, code samples, and inspiration to build communications and digital engagement experiences.