Is there a plan to support AWS IoT?

Hi,

We are planning to build an device management system using all serverless services from AWS. This will include API Gateway, Lambda, DynamoDB and IoT. Please excuse me if this is a dumb question, but I have found support for everything except the IoT service. Is there any plans to support this and if not, does anyone have recommendations on how I could add the support.

The Serverless framework support IoT via CloudFormation. I’ve created a project similar to yours (see AWS IoT with the Serverless Framework | by John McKim | Serverless Zone). The only change you need to make is to update the variabelSyntax in serverless.yml to allow you to use the IoT SQL functions.

1 Like

Thank you, that is very helpful

Hi John,

thanks for all your posts on Garden Aid.

A question as I’m new to AWS, AWS IoT and Serverless, do you have any instructions on how to deploy all of the different services on AWS.

For instance, for GitHub - garden-aid/iot-hub: IoT Hub for Garden Aid, I can see there is a deploy.sh but it show “Error: Please set IOPIPE_KEY env var” and for “sls deploy” I get the below error complaining about the function clientId().
If I hard code the clientId, the sls deploy works up to a point when a "Fn::GetAtt reference Undefined is shown as in the below screenshot

It would be really helpful if you could point out how to resolve this issue and allow me to deploy the IoT service onto AWS.

Thanks in advance,
Ettore.

Serverless Error ---------------------------------------
 
 Invalid variable reference syntax for variable clientId().
 You can only reference env vars, options, & files. You
 can check our docs for more info.

Hi, IOPipe is a separate service I tried for this project. I like the service but using it is completely option in your own projects.

Invalid variable syntax for clientId() looks like a bug. That project uses a custom variable syntax to allow the use of IoT variables in the serverless.yml. Specifically it is setup so normal variables become ${{opt:blah}} so I can ${clientId()} in the rule actions. This has been broken by the framework many times :frowning: . I’d suggest filing a bug about that issue.

That second error relates to a change the Serverless framework made when they went from 1.0.0-alpha to beta I believe. The naming scheme for CloudFormation resources changed. The change means checkMoistureLevel becomes CheckMoistureLevelLambdaFunction in CloudFormation. So anywhere in the resources section it should now be CheckMoistureLevelLambdaFunction instead of checkMoistureLevel. I hope that helps.

Feel free to submit a PR to fix these problems if you get around to it :slight_smile:

Hi John,

and many thanks for your reply.

I managed to have it working by removing the new variable syntax
and changing back the way other ordinary variables are accessed e.g. ${}. I will file a bug soon and share the link here.

Regarding the env file, as with the Serverless 1.6 version the access to env file is managed through the file syntax now, do you know how to access nested variables for “stageName” and “topicPrefix”. See my post [here] where I show what I mean by using your example (Access nested variable in env.yml) .

Excuse my ignorance, what is it a PR? Peer review?

Thanks,
Ettore.