AWS Status Hotline via Twilio

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:
AWS Service Health Dashboard - Dec 16, 2008-1
About 10 minutes later, we had a finished status hotline!  Try it out, give a call to:
(206) 866-5918

Building the AWS Status Hotline

Building it was quite simple.  First, I grabbed a Seattle (206) phone number from Twilio:
Twilio_ Web Service API for Making and Receiving Phone Calls, building hosted IVR and PBX telephone applications
and pointed it toward my application URL:
Feel free to click that link, you’ll see the TwiML in your browser!
When you call, that initial page reads a list of AWS Services to you, asking you to pick which one you’d like status for.  I use the <Say> verb to read the names of the services, and the <Gather> verb to let the caller pick which service they want to hear status for.
Index.php - twilio demo (slice1)
When a digit is pressed, it submits to handleStatus2.php.  This script fetches HTML from 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 <td> containing the name of the service, and the next <td> contains the service status:
HandleStatus2.php - twilio demo (slice1)
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, and uses preg_match to find the service status line based on the regex:
HandleStatus2.php - twilio demo (slice1)-3
One we have the service and status strings, let’s output some TwiML to read the status to the caller:
Index.php - twilio demo (slice1)
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 <Redirect> verb to send the caller back to the main menu at index.php.

What about AWS RSS Feeds?

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 page, you’ll see a list of RSS feeds, one for each service:
AWS Service Health Dashboard - Dec 16, 2008
When I open those feeds in my reader, I get a single <item> entry reporting the status:
Amazon Elastic Compute Cloud (US) Service Status Source
But when I request the same feed URL in PHP, I don’t get the <item> block!
HandleStatus.php - twilio demo (slice1)-1
Here’s what I get back:
Source of_ http___demo.twilio.com_jeffiel_aws-status_handleStatus.php
So it seems we have a case of a missing <item> 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 <item> status when fetched via PHP.