In Node-RED i'm using the mqtt out node to send data to aws. Then aws has a rule which specifies to send the data to a lambda function. I then have an mqtt in node which is subscribed to messages from aws.
Now when I send data to aws over a test topic, I'm getting the data sent back to me with the mqtt in node. I'm not publishing anything from the AWS side and this happens regardless of what the topic is (even when it doesn't match what I've specified in the rule. Why is this automatically being sent back to me? Does AWS just automatically republish the data on the same topic?
edit:
I have a mqtt out with the topic test and then in a different flow, an mqtt in with the topic test.
I am publishing a message to AWS with the topic test. And then in another flow I am susbcribed to the topic test. When I publish a message to AWS with the topic test, even though AWS is not subscribed to the topic 'test', I still get the data on the mqtt in flow. How can this be if AWS isn't publishing anything to the test topic.
Is it just because they are both connected to the same server and since I am publishing to a topic, anything subscribed to that topic will receive the data. Does AWS not have to actually do anything?
As I mentioned in the comment it's not 100% clear what you are asking here but I'll guess.
Any client that is subscribed to a topic will receive all messages published on that topic. This includes messages it published it's self.
e.g.
Node-RED is subscribed to foo/bar and publishes a new message to foo/bar then it will receive it's own message back.
Related
Im using AWS Lambda for sending emails by Amazon SES.
Each time that the request send_email succeeds I got the message id like confirmation.
But now, I want to use somehow this messageId. For example to know if this message concretelly get delivered or bounced.
CloudWatch offers me metrics, with the number of delivered or bounced messages but I want to look throught each one.
¿Is there any statement that allows to know the state of a message by id?
Due to the asynchronous nature of SMTP and how mails are being routed, you can't have this information immediately when sending an e-mail (via SES or otherwise).
However, AWS provides a feedback system which notifies an SNS topic when a message is delivered, bounced, or a complaint was received.
While the documentation is very detailed, the general idea is that you subscribe your own lambda(s) to the configured SNS topic(s) and you can then handle these events as you see fit (i.e. persist data on DynamoDB, call your unsubscribe API and so on).
On AWS I'm trying to create a cloudwatch alarm that sends a notification to a sns topic that in turn triggers a lambda function that is subscribed to the topic, but have run into a bit of a snag in which my lambda is never triggered. I've followed several tutorials on how to do this, I've manually tested the sns -lambda connection and this is working as is attaching the notification trigger onto cloudwatch.
I've done this all through cloudformation.
I have also tried to configure it manually from the cloudwatch console and then noticed something strange. Underneath the Send a notification to select box as shown in the image below, there is a message which says Only email lists for this account are available. So I'm guessing from that, that somewhere in this account, there is a weird setting that needs to be changed?
Updated answer:
Is the CloudWatch alarm actually in the "Alarm" state? Can you add 2 more notifications to be triggered by the "OK" and "Insufficient data" state respectively?
by reading the original post, SNS should have the right permission to invoke the Lambda function.
previous answer:
That is a general message, it has nothing to do with your SNS topic settings. I reckon it's meant to say only emails opt-in to that SNS topic will get emails.
Q: How does Amazon SNS validate a subscription request to ensure that notifications will not be sent to users as spam?
As part of the subscription registration, Amazon SNS will ensure that notifications are only sent to valid, registered subscribers/end-points. To prevent spam and ensure that a subscriber end-point is really interested in receiving notifications from a particular topic, Amazon SNS requires an explicit opt-in from subscribers using a 2-part handshake:
i. When a user first calls the Subscribe API and subscribes an end-point, Amazon SNS will send a confirmation message to the specified end-point.
ii. On receiving the confirmation message at the end-point, the subscriber should confirm the subscription request by sending a valid response. Only then will Amazon SNS consider the subscription request to be valid. If there is no response to the challenge, Amazon SNS will not send any notifications to that end-point. The exact mechanism of confirming the subscription varies by the transport protocol selected:
For HTTP/HTTPS notifications, Amazon SNS will first POST the confirmation message (containing a token) to the specified URL. The application monitoring the URL will have to call the ConfirmSubscription API with the token included token.
For Email and Email-JSON notifications, Amazon SNS will send an email to the specified address containing an embedded link. The user will need to click on the embedded link to confirm the subscription request.
For SQS notifications, Amazon SNS will enqueue a challenge message containing a token to the specified queue. The application monitoring the queue will have to call the ConfirmSubscription API with the token.
Note: The explicit “opt-in” steps described above are not required for the specific case where you subscribe your Amazon SQS queue to your Amazon SNS topic – and both are “owned” by the same AWS account.
Device can send message to the AWS IoT rules engine either via MQTT, HTTP or basic ingest. Rules engine uses SQL query to listen on topic and selects the data when topic matching the FROM clause arrives.
Code to send MQTT message:
device.publish('topic/subtopic, payload)
Code to send message via basic ingest is:
device.publish('aws/rules/topic/subtopic, payload)
URL to send message via HTTP POST is:
https://IoT_data_endpoint/topics/url_encoded_topic_name?qos=1
MQTT involves broker (pub/sub). So message sent to topic via MQTT will reach all subscribers. Similarly message sent via HTTP will also reach to all subscribers. Where as basic ingest bypasses the broker, thus saving cost and also since broker is not involved the message will not reach any subscribers. Have I understood this correctly?
Where as basic ingest bypasses the broker, thus saving cost and also since broker is not involved the message will not reach any subscribers. Have I understood this correctly?
Correct - MQTT subscribers will not receive messages that are sent using basic ingest as the broker is bypassed.
From the documentation at https://docs.aws.amazon.com/iot/latest/developerguide/iot-basic-ingest.html
Basic Ingest optimizes data flow by removing the publish/subscribe message broker from the ingestion path
And the "Designing MQTT Topics for AWS IoT" whitepaper at https://d1.awsstatic.com/whitepapers/Designing_MQTT_Topics_for_AWS_IoT_Core.pdf
Basic Ingest enables you to send data to only cloud services through the Rules Engine.
MQTT clients cannot subscribe to the Basic Ingest reserved topics:
Your devices and rules cannot subscribe to Basic Ingest reserved topics
See https://docs.aws.amazon.com/iot/latest/developerguide/iot-basic-ingest.html
I know that Amazon Pinpoint enables 2-way SMS, but I was wondering whether it was possible to save the message that the client sends. I'm finding myself going down the AWS rabbit-hole a bit, but I was wondering if anyone has any recommendations as to what AWS services could hold onto response data.
Just to clarify, I understand that Pinpoint allows us to return automated messages when the client passes a keyword. I am also aware that we can create user segments to save user attributes, I am moreso inquiring whether there is a way to stream user responses (that are not keywords) to another service or topic. Thank you!
An overview of Amazon Pinpoint two-way messaging can be summarized as per the above sample architecture.
You can capture the incoming messages from your users using the SNS topic you would have created when activating Pinpoint two-way messaging i.e When your users reply to your SMS message using the long code number, Amazon Pinpoint sends a JSON payload to the Amazon SNS topic that you designated. As a developer you handle these incoming messages by adding subscriptions to this SNS topic. The supported subscriptions include SQS, Lambda, email, HTTPS endpoint or SMS.
A sample JSON payload that your SNS topic subscriptions would receive would resemble the following :
{
"originationNumber":"+27155550000",
"destinationNumber":"+2722255511111",
"messageKeyword":"START",
"messageBody":"Hello World from Amazon Pinpoint",
"inboundMessageId":"cae173d2-66b9-564c-8309-66b9",
"previousPublishedMessageId":"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
}
Hope this Helps!
I am writing a rule in IoT core which sends messages to SNS and SQS. In SQS the data is being stored in queue successfully. But SNS is not sending an email. I have followed the same AWS documentation but of no use. I am tried in different accounts and also different email addresses. Can anyone solve this issue