Create a Weather Dashboard using Weather Underground and AWS Lambda

on September 7 | by


Project difficulty:  suuuuper easy
*Note:  as AWS frequently updates their services, some steps in this tutorial may slightly differ over time

Create an Initial State account:

Create a bucket:

  • Click the create bucket icon icon (Create HTTPS Bucket)
  • Name your bucket whatever you want
  • Check the Configure Endpoint Keys box
  • Click Create

Create a Weather Underground account:

Obtain a Weather Underground API key:

  • The free, Stratus Developer plan should already be preselected
  • Click Purchase Key
  • Fill out the form and click Purchase Key again
  • On the next page, copy your Key ID  (this is your Wunderground API Key)

Wunderground API Key Form

Create an AWS account:

Create a Lambda function:

      • Under AWS Services, navigate to Lambda
      • Click Get Started Now
      • Select Blank Function
      • On the Configure triggers page, click the empty, dashed box next to the Lambda logo
      • Select “CloudWatch Events – Schedule”

AWS Lambda CloudWatch Events - Schedule

    • In Rule name, name the function whatever you want — I named mine “periodic-15” because I want this trigger to happen every 15 minutes
    • In Rule description, briefly describe the rule
    • For Schedule expression, select “rate(15 minutes)” from the dropdown
    • Do NOT select enable trigger; we will do that later

Configure Lambda Function

    • On the Configure function page, name the function… I named mine “wunderground-weather”
    • Though not necessary, feel free to write a function description
    • Keep Node.js 4.3 selected

Lambda - Configure for Wunderground

    • Within the Lambda function code text box, paste this code
      *Note:  the code found in the GitHub Gist above has been updated to filter out the inconsistent timestamps sent by Wunderground’s API
    • Paste your Initial State Bucket Key, Initial State Access Key, and Wundergound API Key in the highlighted fields
      (your Initial State Bucket and Access Keys can be found within your bucket settings)
    • In Handler, type index.handler
    • For Role, select “Create custom role” (this will open a new tab)
    • For IAM Role, select “basic-execution”
    • For Policy Name, select “Create a new Role Policy”
    • Click Allow

    • Now for Role, ensure “Choose an existing role” is selected
    • For Existing Role, select “service-role/basic-execution”
    • Leave everything else as is and click Next

    • Review your work, then create your function!

    • On the next page, test the code
    • An Input test event box will pop up with the “Hello World” sample event template
    • Leave that as is and click Save and Test

  • On the Triggers tab, select Enable
  • You just created a Lambda function! Weather data will now stream to your Initial State bucket every 15 minutes.


9 Responses

  1. alex says:

    thank you, but AWS Lambda is free ?

  2. John Fraser says:

    Thanks for the tutorial !
    I am a newbie and encountered a problem when trying to paste the code into the Lambda code-entry box, on my Raspberry Pi. I had “Edit Code Inline” selected (and there were already 4 lines of existing code there). I was not able to change or delete the existing 4 lines, nor was I able to paste the Wunderground code into the box. Also saved the code as a .zip file and then tried the “Upload zip file” Functionality – that didn’t work either. Probably something silly that I am missing … any suggestions?
    Thanks !

    • Kaylee says:

      Hey John, try editing the code on an up-to-date Chrome browser, not on your Pi. I’m not sure if the AWS Management Console works on a Raspbian browser.

  3. Steve says:

    Hi Kaylee. Many thanks for the tutorial. It currently working great here. One question for you. Is there a way to change the weather reporting to Celsius, and wind speeds to KM per hour. My Location is Waterford, Ireland. Many thanks steve

  4. Mark Brown says:

    How does one get all of the applets you have in your first picture?

Leave a Reply

Your email address will not be published. Required fields are marked *

« »

Initial State Technologies, Inc.
Scroll to top
Initial State