Press "Enter" to skip to content

Weekend Enthusiast Posts

Using AWS Lambda to Send SNS Topics in CloudWatch

AWS Lambda enables you to run code without managing a server.  You simply plop in your code and it does the rest (no maintenance, scaling concerns, etc).  The cost is only $0.20 per 1 million requests/month and the first million requests are free each month. In the previous post, I setup an SNS topic. I’m extending this further so that a node.js function will be triggered in AWS Lambda each time my SNS topic is triggered. This Lambda function will feed metrics into AWS CloudWatch which will allow me to chart/monitor/set alarms against events or patterns with my SNS topic.  A practical use case for this could be understanding event patterns or logging SNS messages (and their contents) sent to your customers. Creating your Lambda Function From the Lambda page of the AWS console, select “Create Function”.  From here, we’ll author from scratch.  Below are the inputs I’ve used for this example:Name: SNSPingerToCloudWatchRuntime: Node.js 8.10Role: Choose and existing roleExisting role: lambda_basic_execution On the page after selecting “Create Function”, we’ll click “SNS” from the “Add Triggers” section and then select our SNS topic in the “Configure Triggers” section.  Then click “Add” and “Save”.  Here’s a screenshot of the final state. Next, click on your function…

Publish to AWS SNS Topic With PHP

Simple Notification Service (SNS) is a handy AWS product which enables programmatic publication and subscription to topics.  They can be as simple as email or SMS or involve more complicated services complicated like Lambda, SQS, HTTP, etc.  The write-up below walks through the process end-to-end from installing the AWS PHP SDK to publishing your first message as an SMS/text message.  With a small amount of additional effort, one could quickly expand this to use cases like weather/emergency notifications for office buildings/schools. The first two steps are one-time setup, walking through AWS PHP SDK installation and IAM Role creation (something new to me).  The remaining steps are a rinse-and-repeat process so future SNS projects should only take minutes to setup.  For this example, I spun up a LAMP instance in Lightsail so my approach is tailored to this default config. Step 1: Installing/Prepping the AWS PHP SDK We’re going to do this by using Composer so let’s install that: curl -sS https://getcomposer.org/installer | sudo php Next, we’ll create composer.json to add the right dependency for the AWS SDK: sudo nano composer.json And inside composer.json, we’ll add this requirement: { “require”: { “aws/aws-sdk-php”: “2.*” } } Lastly, we’ll install the dependencies: php composer.phar install The end…

WordPress Blog on AWS for $5

I’ve been with multiple webhosts over the years (DreamHost, Host Gator, Site5, 1and1, SiteGround, and I’m probably forgetting a few) and even ran a reseller of my own for a several years.  In the past few years, large groups like Endurance International Group have been gobbling up mom-n-pops operations like Site5 and Host Gator and immediately making cuts to customer service and, in some cases, product/service quality.  For running small personal blogs and websites, though, their prices are near impossible to beat. I’ve been wanting to take the plunge into AWS for a while now but my projects and their scale haven’t aligned to make it cost-effective for me, a hobbyist.  In late 2016, however, AWS launched LightSail which enables you to launch a virtual private machine with numerous pre-configured images for as little as five bucks a month.  That’s SSD storage (overkill for this scale of project but still a nice feature), healthy transfer limits, free static IP, and the ease of scale that AWS has built themselves on and the end result is a super nice product that acts as a gateway for enabling full migration to AWS.  After literally two or three minutes of playing, I had…

Indexing my movie collection

#FirstWorldProblems – having so many DVDs that you forget what you already own and end up buying multiple copies of the same movie.  While 126 movies isn’t a massive collection, it’s enough for me to sometimes forget what I have when I’m pillaging the $5 bins at Best Buy and Target. To solve for this, I created a Google Sheets list of my collection so I could check what I have from my phone.  After typing all the titles into the list, I realized it’d be very easy for me to use the code I wrote for my DirecTV project to scrape additional details for the movies and create a nice, simple UI….so I did: What it does Using The Movie DB API, I pull several pieces of information about the film and store it locally: title, image, release date, rating, budget, revenue, runtime, synopsis, genres, cast, etc. Storing it locally reduces repetitive, slow API calls and allows me to cleanly add additional attributes like whether it’s DVD, Blu-Ray, Google Movies, Amazon Video, etc. Adding new titles is easy – I just type in the name and the rest of the details populate immediately.   There are two views: one shown…

The house is nearly complete

In the past month, we’ve progressed to essentially 100% complete.  A few minor things and some touch-up work remain but, for the most part, the house is now complete. Progress has been quick with much of the past month spent with interior and exterior work happening in parallel:   As of today, landscaping/exterior work is complete except for some small fence work.  We’ll be doing a few additional things in the future to build out the slope in the backyard but that’s most likely a project for next year:   The post-drywall interior has also come a long way in the past month:   We’ve planned our move for the week of the 24th.  Until then, it’s time to get busy packing and prepping to vacate the apartment.

Drywall, texture, and paint

After the siding was finished, the gutters and gas meter were installed before painting.  At this point, all exterior painting is complete pending some touch-up work.   On the interior, all drywall work is complete with texture and first coat of paint on.  After next steps (cabinets and flooring), we’ll have another coat of paint to ensure good coverage and to capture any damage from the flooring/cabinet installation.   The driveway is being prepped for pouring and the yard has been prepped for sod and landscaping.  We met with the landscaper POC last week to discuss our plans for the yard.  I suspect we’ll have the driveway poured within a week and landscaping will follow a week after that.  This leaves us with finishing up the interior over the next four weeks — installing flooring, cabinets, counters, light fixtures, and the air conditioner.  We’re still on schedule.  Seeing as we’ll be moving from a small, single bedroom apartment, our next few weekends will be focused on appliance and furniture shopping.

Windows, Wiring, Siding

Over the past month, we’ve had the roof, windows/doors, garage floor, wiring/electrical, plumbing, and most of the siding added.   Our outdoor room is starting to shape up with the fireplace being installed.  I was hesitant about the loss of interior square footage due to the outdoor room but I have to say that as it comes together, it’s becoming one of my most liked features of the house.   As the electrical and plumbing work wraps up, the next steps will be to finish the siding and putting up the drywall.  Our move day is still planned for late October; we’re right on schedule.

Progress on the house

After permits were received, we’ve had great, fast progress with the house.  We’ve gone from an empty lot to both levels almost entirely framed in less than a month.  Foundation work started April 24th and we expect to have a roof on by June 2nd with electrical and plumbing completed by mid-June. Foundation progress over the past month Current state Everything has been on-time and without any major hiccup thus far so here’s to hoping the rest of the build goes well.  We’ve had the tailwind of perfect weather and that’s expected to continue for the next two weeks which means we should have much of the framing work completed without rain.

Logging router traffic and other changes

It’s been a slow couple months between the holidays, travelling, and work.  I did manage to accomplish a few things with the Home Dashboard project, though.  I redesigned the UI to move away from an exclusively mobile interface as the amount of data and type of data I’m including in the project now simply don’t all make sense to squeeze into a mobile UI.  Sometime in early January, the system broke the 2 millionth record milestone — I’m unsure what I’ll do with some of the data I’m collecting at this point but I’ve learned a lot through collecting it and I’m sure I’ll learn more analyzing it at some point in the future. This brings the list of events I’m collecting to: Indoor temperature and humidity Amazon Echo music events DirecTV program and DVR information Cell phone location and status details Local fire and police emergency events Home lights and other Wink hub events …and now home network information Analyzing home network information The biggest change was the addition of network event logging.  After seeing that a foreign IP was accessing my LAN, I started logging each request to or from my home network until I was sure I had fixed…

Collecting and Handling 911 Event Data

Seattle has a pretty awesome approach to data availability and transparency through data.Seattle.gov.  The city has thousands of data sets available (from in-car police video records to land zoning to real-time emergency feeds) and Socrata, a Seattle-based company, has worked with the city (and many other cities) to allow developers to engage this data however they like.  I spent some time playing around with some of the data sets and decided it’d be nice to know when police and fire events occurred near my apartment. I setup a script to pull the fire and police calls for events occurring within 500 meters of my apartment and started storing them into a local database (Socrata makes it so simple – amazing work by that team).  While reading it from the API, I check the proximity of the event to my address and also the type of event (burglary, suspicious person, traffic stop, etc) and trigger emails for the ones I really want to know about (such as a near by rape, burglary, shooting, vehicle theft, etc).  I decided to store all events, even traffic stops, just because.  I may find a use for it later – who knows… After I’ve scrubbed through and sent…