How to create a Lambda function for AWS IoT Button - amazon-web-services

I've read though a couple of tutorials, and watched several videos about this topic, but I'm not able to reproduce the steps shown there.
My AWS IoT Button is configurd correctly and works as it should. I then go to the Lambda Management console, and create a new Lambda function from one of the templates. The screen that appears now is different from all the tutorials and videos. Anyway, I have to choose a trigger and select the IoT Button there. The GUI then tells me to configure that trigger. I then enter the serial number of the Button, and don't touch the certificate options, because I already have keys and certificates on my IoT Button. After I made sure that "Enable Trigger" is selected, and click on the "Add" button. Now I'm getting a red box inside the trigger configuration screen saying:
"Empty list of actions is not allowed. At least one action needs to be defined. (Service: AWSIot; Status Code: 400; Error Code: InvalidRequestException; Request ID: 41c78c96-00fe-11e8-a48a-61538c57d315)"
I'm stuck at this point, because I never can assign any Trigger to my function.

It took a bit of mucking around but I think I've figured out how to get around this.
The error is strange, because of course you're trying to create an action. It seems like it's a bug.
Fortunately, you can create it around the other way:
Visit the AWS IoT console
Go to the Act option in the sidebar menu
Click Create to create a new rule
Give a name, and description
For the SQL rule, build a rule that looks like SELECT * FROM 'iotbutton/+' (i.e. enter * for Attribute, etc.)
Add your action - your Lambda function :)
Add an error action too if you wish
Click Create Rule
Press your button and confirm that your Lambda function ran!
I'm assuming you could put your button's DSN in place of the + in the select statement if you have more than one button.

Related

How do I check the information sent by the GTM event trigger to Recommendations AI project?

Could someone inform what is the most correct way to verify what is the information sent by the GTM event tag screenshot to an Recommendations AI project?
Confirm your triggers are not misfiring by using the preview mode in GTM: https://support.google.com/tagmanager/answer/6107056?hl=en
As Eike mentioned, open the Developer's console Network tab https://developer.chrome.com/docs/devtools/network/
Clear the log in the Network tab. And select All in the Network filters.
Conduct an action that triggers your tag.
In the Network tab, there are now new activity is shown. Select the one that looks like your endpoint and that has a valid response code (it's almost always 200)
Scroll down to the Query String parameters and assess your payload:
Like so:

Trying to set up AWS IoT button for the first time: Please correct validation errors with your trigger

Has anyone successfully set up their AWS IoT button?
When stepping through with default values I keep getting this message: Please correct validation errors with your trigger. But there are no validation errors on any of the setup pages, or the page with the error message.
I hate asking a broad question like this but it appears no one has ever had this error before.
This has been driving me nuts for a week!
I got it to work by using Custom IoT Rule instead of IoT Button on the IoT Type. The default rule name is iotbutton_xxxxxxxxxxxxxxxx and the default SQL statement is SELECT * FROM 'iotbutton/xxxxxxxxxxxxxxxx' (xxx... = serial number).
Make sure you copy the policy from the sample code into the execution role - I know that has tripped up a lot of people.
I was getting the same error. The cause turned out to be that I had multiple certificates associated with the button. This was caused by me starting over again on the wizard, generating cert & key, loading cert & key again. While on the device itself this doesn't seem to be a problem, the result was that on AWS I had multiple certs associated to the device.
Within the AWS IoT Resources view I eventually managed to delete all resources. Took some fiddling to get certs detached and able to be deleted. Once I deleted all resources I returned to the wizard, created yet another cert & key pair, pushed the Lambda code, and everything works.

AWS Lambda: error creating the event source mapping: Configuration is ambiguously defined

There was an error creating the event source mapping: Configuration is ambiguously defined. Cannot have overlapping suffixes in two rules if the prefixes are overlapping for the same event type.
I created an event earlier from the GUI console 6-7 days ago and it was working fine. The next day the event just missing, i cant see it anymore at the Lambda console GUI. But every S3 objects still seems triggering the lambda function not a problem. If i cant see, it is not good; So i deleted the Lambda function, waited for 5-10 seconds before creating another new function. And now, i receive the same above when i try to create the event sources like this:
When i click "Submit" the event sources tab says "You do not have any event sources for this function", Lambda does not get triggered; it means the entire application flow is now broken :(
The problem is almost the same as: "https://forums.aws.amazon.com/thread.jspa?messageID=670712򣯸" But somehow i cant reply to that thread, so i created a new thread here instead. anyone encounter this issue?
In fact, i try to response to the existing AWS forum thread: https://forums.aws.amazon.com/thread.jspa?messageID=670712&#670712
but i keep getting this funny error: "Your message quota has been reached. Please try again later.". And i wasnt even posting anything, how can i use up my quota?
What I suspect is your S3 bucket may still be "linked" to the lambda function.
Maybe check your S3 bucket for events and remove them there, then try creating the lambda events again?
i.e. S3 bucket-> properties-> Events
After 6 years nice to see some people still befitting from this answer,
Here is a shamless plug to youtube video I uploaded 2022-12-13.
https://www.youtube.com/watch?v=rjpOU7jbgEs
The issue must be that the s3 bucket is already linked with the suffix/prefix you are trying to link. Remove the link in S3 and try again.
When you setup a lambda function and setup a trigger related to S3. The notification gets updated in the properties sections of that S3 bucket.
The mentioned error occurs when the earlier lambda function is deleted and you're trying to setup same kind of trigger again. This time the thing to note is, the S3 notification is still not deleted when you deleted the lambda function.
Goto S3 bucket > Properties > Event notifications
and delete the old setting and then setup new trigger in the new lambda function trigger.
Here is a link to a youtube video profiling this issue and demonstrating the solution:
https://www.youtube.com/watch?v=1Tfmc9nEtbU
Just as Ridwaan Manuel, you must remove the events by going to S3 bucket-> properties-> Events as the video shows.
Steps to reproduce this issue:
Create a bucket and create a folder called “example/”
Create Lambda Function
Add S3 trigger to the lambda using the bucket from (1) with default settings
Save the trigger
Click Save and notice error
Refresh the page and notice that the triggers disappeared
Add the same bucket again and notice the ambiguous reference error

VmWare vSphere: send automatically mail/notification on event

I'm new on vsphere and I have an important question.
Is there a section where I can set parameters that allow a vsphere to send me notifications/email when a condition happens?
For example when a virtual machine cpu usage go over a value that I have set as 'alarm value' or when a virtual machine disk space usage go over a value vsphere send an email/notification that inform me.
I try to navigate over the menu but I don't find anything like this.
can I use an external app?
Haven't done it myself but according to the documentation:
In the Actions tab of the Alarm Settings dialog box, click Add to
add an action.
In the Actions column, select Send a notification email from the drop-down menu.
In the Configuration column, enter recipient addresses. Use commas to separate multiple addresses.
If you're not familiar with alarms at all you may want to take a look at their Alarm Example.

Unable to select a topic for Amazon Transcoder

I want to have my Amazon Transcoder post a notification to a SNS topic when some events happen, but unfortunately I'm getting an error message when I try to select the existing topic from the "Edit Pipeline" page: "Role ARN is invalid: does not start with arn"
I'm not sure what I'm doing wrong, apparently it seems pretty straightforward. Here's the steps I've done:
Selected my Pipeline
Click "Edit"
Went to "Notifications" sections and created a new topic right there (here I would expect it to have auto selected after the creation but apparently it just creates and nothing else happens..)
so.. I selected "Use an existing SNS topic" and selected the recently saved topic
Hit "Save" button
Got the error
What am I doing wrong?
Thanks in advance
This seems to be a rather weird UI bug in the AWS console.
When you edit your pipeline to set the SNS topic, the select box for the pipelines IAM role is incorrectly set to -- Console Default Role -- (it should be Elastic_Transcoder_Default_Role. The entries beginning with -- probably shouldn't be selectable at all!)
Now, when saving the form, this will cause the error.
This is not related to the selection of the Topic, as it might seem.
By changing the Role back to Elastic_Transcoder_Default_Role the error goes away.