Monthly Archives: June 2015

Hands-on with Amazon Echo


I was in the market for a Bluetooth speaker that had decent sound.  I got that and then some with the new Amazon Echo.  I received the Echo yesterday through a Prime pre-order.  Amazon has put a lot of thought and effort into the packaging of the Echo.  The unboxing was reminiscent of unboxing an Apple device.Amazon Echo Unboxing

The first thing that struck me was the size and weight of the Echo.  Here’s a pic showing the speaker on my desk next to a CD (Classic Quadrophenia) that should give an example of the scale.

Amazon Echo

Note the blue ring in the pic too.  When the Echo is thinking or responding to something, the blue light is on.  The ring can turn bright red if, for example, the Echo loses its wifi connection.  It did that once yesterday when I had the device in the kitchen (fairly far away from the wireless AP to which it was connected).

On the top are two buttons, one is a mute button for the mic, if you don’t want the Echo listening to your every word.  The other is a button that can be pressed to wake up the Echo to receive a command, if you don’t want to speak the “wake word”.  At this time, the only “wake words” are “Alexa” (the default) and “Amazon”.  I’m guessing they’ll change that eventually so that you can customize or choose a “wake word”.

Amazon Echo Setup

Setting up the Echo is rather straightforward.  Plug it in.  The Echo takes about 40 to 45 seconds to boot, during which time the blue ring will use a white rotate effect.  When the Echo is booted the first time, the ring will turn orange and the Echo will say “Hello”.  The next step is to visit http://echo.amazon.com or download the Echo app from your respective App Store.

The echo sets up its own temporary wifi network and will audibly tell you to connect to that wifi network using your device.  When you do so, you’ll then be able to choose the wifi network to which the Echo should connect.  The Echo will then connect to your home wifi network and you’re ready to roll.

The Echo also comes with a remote and a fairly powerful magnetic holder for said remote.  I haven’t yet experimented with the remote.  I suppose the use case for the remote is when you don’t want to shout “Alexa, stop” across the room.

The Bluetooth pairing process is easy too.  Simply say “Alexa, connect” and the Echo will go into a mode where it can be seen and paired to nearby devices.  There is no additional security code to enter, so anyone nearby who is watching could theoretically connect to the device while in pairing mode.  Connecting and disconnecting devices from Bluetooth is as easy as saying “Alexa, connect” and “Alexa, disconnect”.

The “Alarm” feature might be useful, though there doesn’t seem to be a way to set the alarm tone, just the time.  You can speak the alarm time, like “Alexa, set an alarm for 2pm” and watch as it gets set within the Echo web site.  That’s a novelty though and I haven’t explored the alarm function beyond merely setting it and then jumping out of my chair when the alarm went off and I had the volume too high.

Speaking of volume, there are multiple ways to adjust the volume.  Saying things like “Alexa, increase volume” will make the playback louder and you can also say “Alexa, volume 3” to manually set the volume to a certain level.  Sadly, the range is 0 to 10 and not 11, as I was hoping.  There is also a dial on the top of the device that can be turned left and right to manually adjust the volume.  Manually adjusting the volume gives finer control over the output. For example, saying “Alexa, volume one” will result in the 0 through 10 scale, but you can still adjust the volume down below one manually.

There is a news function and you can customize from among several audio feeds such as NPR, BBC, Economist, and others.  Saying “Alexa, news” begins these feeds and “Alexa, next” skips to the next “Flash” news feed, as they are called.  For non-audio based feeds, the Echo reads the news aloud.

Weather is available for the current location and you can ask for future or current conditions for  both local and remote locations.

How’s the Sound?

I bought a Bluetooth speaker with good sound.  The Echo has that.  The sound is rich and full range, with sufficient bass and midrange.  With any small-size speaker there is a simple inability to move a lot of air, as you would find on a full-size speaker.  Therefore, I don’t believe a Bluetooth speaker will ever be able to provide the drive of a nice JBL monitor.

I set up a playlist through Amazon Prime Music and can now do things like “Alexa, shuffle playlist Classic Rock” and random songs will be chosen from that playlist.

Conclusion

I suspect Amazon will be working hard to enhance the Echo.  For instance, the calendaring function currently only works with Google Calendar.  I’d love to see that integrated with other calendaring options, maybe through the Alexa AppKit or natively.

I can see the need to order additional accessories like power supplies so that I can move the Echo to different rooms… though I suppose I could just order more Echoes.

I haven’t yet explored the home control aspects of the Echo that can be found with Belkin Wemo devices, though I’m hoping to.  I’m hopeful that Amazon won’t release an “Echo 2” right away so that this is instantly obsolete either!

Deploying and Debugging PHP with AWS Elastic Beanstalk

AWS Elastic Beanstalk provides a compelling platform for deployment of applications. My web site, the one you’re viewing this page on now, has historically been deployed on a Linux computer hosted somewhere.  Well, ok, the software from which you’re reading this is WordPress but it’s hosted on the same Apache server as the main web site.

I recently redesigned the main site and in the process purposefully made the site more portable.  This essentially means that I can create a zip file with the site, including relevant Apache configuration bits contained in an htaccess file and then deploy them onto any equivalent server, regardless of that server’s underlying Apache or filesystem configuration.

That got me thinking:  Can I deploy the site onto Elastic Beanstalk in Amazon Web Services?  The answer:  Yes I can.  The path that I followed was essentially to clone a clean copy of the repository from git and then create a zip file with the contents but not the .git-related bits.  Here’s the command, executed from within the directory with the code:

zip -r braingia.zip . --exclude=\*.git\*

The next step is to then deploy this into AWS Elastic Beanstalk.  That’s relatively straightforward using the wizard in AWS. In a few minutes, AWS had deployed a micro instance with the code on it.  I needed to undo some hard-coded path information and also redo the bit within the templating system that relied on a local wordpress file for gathering recent blog posts.  It wasn’t immediately clear what the issue was though, and the biggest challenge I encountered was debugging.

Debugging PHP in Elastic Beanstalk

My workflow would normally call for ssh’ing into the server and looking at error logs.  However, I found that adding the ability to display errors was helpful.  That setting is found within the Configuration area of Elastic Beanstalk:Display Errors in Elastic Beanstalk

However, that’s not a setting I would use on a production site.  There are two other ways to troubleshoot Elastic Beanstalk.  First, you can view and download Apache logs and other related logs from Elastic Beanstalk.  For example, adding error_log() statements to  the code would result in log entries in these easily-viewable logs.

The other debug option is to enable an EC2 key pair for the EC2 instance associated with the application.  This is done at application creation or later through the Configuration.  Therefore, I simply deployed another application with the same Application Version and chose an EC2 key pair this time.

EC2 Key Pair

Note that AWS replaces the instance entirely if you change this key at a later date, so if you have Single Instance-hosted version of the application, the site will be unavailable while a new instance is spun up.

AWS Red Status

Once the key pair is enabled on the server, it’s simply a matter of ssh’ing into the EC2 instance using the key and the ec2-user account, like so:

ssh -i mykey.pem ec2-user@example.elasticbeanstalk.com

Doing so, it’s easy to navigate around to see everything on the server, including log files.

SSH to Elastic Beanstalk

Note that the current version of the application can be found within the /var/app/current directory on Elastic Beanstalk-deployed PHP applications.  You can even edit files directly there, but I wouldn’t recommend it since it breaks the zip-based deployment paradigm and architecture.

In summary, Elastic Beanstalk deployment and debugging were much easier and much more powerful than I envisioned.