Tuesday, October 24, 2017

ATECC508A Embedded Crypto - AWS costs

TL;DR;  Dont leave aws_interact_gui.py running!

In my previous post, I wrote about my first impressions setting up AWS.

This is just a quick blog post to show my crazy AWS charges after just a few days. Actually, not so much the cost, but the number of messages:



Note that my AWS IoT monitor has recorded less than 20 connections.


Also on that page, just a bit further down - shows I've only published a few hundred messages:

And only 2 rules executed:


Yet somehow, I've been charged for hundreds of thousands of "messages". The curious thing, is they are listed under the "Shadow Message".

So ok - 2 bucks is not a big deal... but scale that for more devices and more than a few days - and the costs get out of hand really rather quickly.

I've posted a message on the AWS forum requesting help in understanding these charges. I'm wondering if simply launching the shadow monitoring page... if there's perhaps there are repeated messages from the browser to my device such as this shadow monitor:
I've contacted AWS billing, but they have "limited access" to give me any more details as to exactly how those hundreds of thousands of messages occurred.

Fortunately, the folks at Microchip are super responsive. I had an answer within hours! (Thanks, Ben!) The forum answer copied here:

The demo GUI (aws_interact_gui.py), polls the GetThingShadow (http://docs.aws.amazon.com/iot/latest/developerguide/API_GetThingShadow.html) API function to show the current shadow state. However, if left running, its polling period of 500ms could incur a lot of messages.

This polling method was not intended to be an example of how an IoT system would interact with the devices, but just a quick and easy way to display the state. Typically, one would use the IoT rules engine to trigger other actions within AWS:http://docs.aws.amazon.com/iot/latest/developerguide/iot-rules.html
We're looking into changing how this script works so leaving it running doesn't create so many messages.

So the super important take-away here is to NOT leave the aws_interact_gui.py running (at least not until updated)! At 500ms intervals (2 per second), that would be 31*24*60*60*2 = 5,356,800 messages per month! Even at $5 per million messages, that's $30 a month just to leave the diagnostic app running.

Stay tuned... I'm now digging into the RTOS code which is really quite interesting :)


2 comments:

  1. JAN.2018 - near all links to the Atmel/Microchip SW resources in your text are not more working and are leading only to the home page ofth microchop.com site :(
    Because I bought the AT88CK590 kit only recently I perceive such behavior of the the Microchip company as fraud, because the sale of the kits had to be stopped without the relating SW.

    ReplyDelete
    Replies
    1. oh no! ya, that's one of the really not cool things about the internet. thanks for heads-up.

      Delete

comments are welcome, but I prefer not to allow links to promotions or other unrelated services.

Find gojimmypi at gojimmypi.github.io

I'm currently working on my new blog home at  gojimmypi.github.io After implementing a variety of features such as dark mode , syntax hi...