Using AWS Lambda and Golang to access real-time weather station data

Using AWS Lambda and Golang to access real-time weather station data
How KuNa Fish makes fish processing and packaging a piece of cake
3 Reasons why you need a power failure detector at your construction site
Why you need a freezer power outage alarm in an industrial fridge or cold room
What is the difference between ultrasonic and electromagnetic flow meters?
Planning your onion storage facility: 3 things to consider
How Bert gets the best deal for his onions by using a smart storage system
When do you need a titanium level sensor?
Unlock the Power of Weather Data with Weather Station API
4 Things to look for in a temperature sensor with API
Choosing the right tool for measuring relative humidity in concrete structures
3 reasons why storing records needs remote monitoring
3 reasons why you should monitor your roof garden
The importance of lux in offices: 500 lux
Protecting fruit tree blossoms from freezing with the aid of frost detection
Comparing the Watermark sensor to the WaterScout SM100
Pseudomonas syringae and frost damage in fruit trees
Understanding the difference between Crodeon and other remote monitoring systems
Preventing frost damage in a cactus greenhouse
Monitoring heat treatment in cargo containers
4 fantastic ways to monitor your hydro garden or vertical farm
Making blueberry farming more sustainable: Reporter and the water balance model
Measuring lux in chicken pens, pigsties and other stables
PAR & plants, is it the right light sensor for you?
Temperature registration for HACCP
Poultry monitoring and alarm
An easy and reliable weather station
Easy online dewatering
Livestock heat and suffocation alarm
Cold room monitoring
Smart watering system using remote irrigation monitoring
Storm & scaffolding: use a weather station to your advantage
Using a weather station on your construction site
Irrigation control with remote monitoring
Professionally farming mealworms: Measuring CO2, temperature and humidity
Remote Monitoring IoT
Real-time frost detection
Save money on office heating with smart technology
Sustainable water usage: using wireless sensor technology to combat drought and register water consumption
10 things to consider when buying a professional weather station
How to tackle the 7 principles of HACCP in restaurants and food companies with simple technology
Wind tracking and monitoring with multiple sensors
The effect of wind on measuring particulate matter
Precision test for the Sensirion SHT35 humidity sensor
Measuring temperature and pressure in real-time
Water level sensor to measure the water level in a container or well
How to measure leaf wetness in combination with relative air humidity
How to measure Dew Point and Wet Bulb temperature
How to make IoT truly accessible to everyone
Installing a weather station on caravans, holiday homes or vacation houses
How the Internet of Things will disrupt the insurance sector

In this blogpost we will try to access the data from a Crodeon weather station from the cloud using the Crodeon Rest API. The cloud technology that we will explore in this example is AWS Lambda and Go.

About AWS Lambda and the Crodeon weather station

AWS Lambda is a serverless, event-driven compute service on which you can run code for almost any type of application or backend service without the need to provision or manage servers. Visit this page for more info about AWS Lambda.

The Crodeon weather station is becoming a popular weather measurement tool, mainly because of its easy deployment, mobile usability and affordable price. The weather station offers a real-time connection to the cloud and out-of-the-box API functionality to integrate the data in your own software. Besides wind, rain, temperature and humidity you can also add more exotic sensors to measure CO2, air quality, water level, pressure, etc… Visit this page for more info about the Crodeon weather station.

weather station aws

Create your AWS Lambda function and trigger

First of all we create a new function called weather-data. For this example we will use Go as our programming language.

aws lambda function weather station

Next we have to add a trigger. This is how we let AWS invoke the function.

For this example we will choose an API Gateway, but AWS offers some interesting alternatives like a Shopify purchase event or an Amazon Alexa trigger.

aws lambda trigger weather station

Now we can see this API gateway will act as a trigger for our newly created lambda function.

aws lambda function-trigger weather station

Writing the Lambda code to call weather data

The web code editor of AWS doesn’t support Go, so we will write our code in Visual Studio Code and upload it as a .zip file.

The zipped file and the contents must have the name of the handler, in this case “main”.

aws lambda source code weather station

Now it’s time to test our code. Click the Test tab and create a new test event. In this example we will choose the API-gateway-AWS-proxy template.

aws lambda test-event weather station

Enter the Reporter ID as the path and the x-api-key and authentication credentials in the headers of the event document template that AWS presents us. Contact Crodeon at info@crodeon.com to get your free demo API credentials.

aws lambda template weather station

The test is successful and the body data contains the values we needed. For this demo we only called 4 of the weather parameters as well as the date and time in UTC format.

aws lambda test-result weather station-min

Start your own sensor project

That’s it! We hope this was useful for some of you. Don’t hesitate to contact us for any further questions about the Crodeon weather station or the Crodeon API. Visit our website to read more about the Reporter, the world’s easiest sensor device for real-time remote monitoring.

Click here to download the Golang source code and the build file that we used for this demo.

Back to blog

Any questions?

Call us at +32474097705 Or use the contact form

1 of 4
  • Live online demo

    Sign up for a free account on the Crodeon Dashboard a watch a real live working demo.

    Watch the demo 
  • Talk to sales

    Schedule an appointment with Jonathan, our Sales Manager, for more information about this solution.

    Schedule a call 
  • Contact us

    For partnerships, distribution, or any other question, don't hesistate to contact us!

    Contact us