Create a Weather Dashboard using Weather Underground and AWS Lambda


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.


13 comments On Create a Weather Dashboard using Weather Underground and AWS Lambda

Leave a reply:

Your email address will not be published.

Site Footer