 module.exports = (robot) ->
   robot.respond /(^|\W)sqs status(\z|\W|$)/i, (msg) ->
     regions = process.env?.HUBOT_AWS_SQS_REGIONS ? defaultRegions
-    getRegionQueues region, msg for region in regions.split ','+    getRegionQueues region, msg for region in regions.split ','
+  robot.respond /(^|\W)ec2 status(\z|\W|$)/i, (msg) ->
+    regions = process.env?.HUBOT_AWS_EC2_REGIONS ? defaultRegions
+    getRegionInstances region, msg for region in regions.split ','
sqs = aws
  .load('sqs', key, secret)
  .setApiVersion('2011-10-01')

getRegionQueues = (region, msg) ->
  sqs.setRegion(region).request 'ListQueues', {}, (error, queues) ->

# Queries for the status of AWS services
#
# hubot sqs status - Returns the status of SQS queues.
# hubot ec2 status - Returns the status of EC2 instances.
#

# Environment variables:
#   HUBOT_AWS_ACCESS_KEY_ID     - The Amazon access key id
#   HUBOT_AWS_SECRET_ACCESS_KEY - The Amazon secret key for the given id
#   HUBOT_AWS_SQS_REGIONS - Comma separated list of regions to query
#   HUBOT_AWS_EC2_REGIONS - Comma separated list of regions to query
#
# package.json needs to have "aws2js":"0.6.12" and "moment":"1.6.2" and "underscore":"1.3.3"
#
