Hi I am developing an application in Java that parses documents using AWS Textract. For multipage parse I use the startDocumentAnalysis method available on the textract client. This client then responds with a jobId and the jobId is placed on the sqs queue along with it's completion status. I had a personal account previously and managed to get all of it working so a process reads messages from the queue and then get the result of the parse using :
GetDocumentAnalysisRequest documentAnalysisRequest = GetDocumentAnalysisRequest.builder().jobId(jobId)
.maxResults(maxResults).nextToken(paginationToken).build();
Now i have to do that on my company's AWS account and i have retraced my steps and everything works except now when i go to pick up the messages from the queue, all the messages come back as [] i.e. empty array.
I use this code:
messages = sqsClient.receiveMessage(receiveMessageRequest).messages();
So i know the error can't be in the java code because previously it worked.
I also know that i can upload to the new bucket and also do single page parses, so i know my credentials are correct.
I have created a topic on sns and registered my sqs to it but somewhere here there must be a permission or other configuration error. Maybe SNS and SQS are not talking to each other?
Wonder if anyone has any insights that could help me.
Thank you
I found the answer. It's all to do with the naming convention of the SNS topic. Explained in the documentation:
https://docs.aws.amazon.com/textract/latest/dg/api-async-roles.html
Step3 - Create an Amazon SNS topic. Prepend the topic name with AmazonTextract. Note the topic Amazon Resource Name (ARN). Ensure that the topic is in the same Region as the AWS endpoint that you're using.
Related
I live in India and I have this requirement where I need to change the default sender Id of text messages sent via AWS SNS to the one that is registered for our organization with TRAI. We are trying to send SMS text messages to customers with Indian mobile numbers. I tried passing TemplateID and EntityId that was issued to us by our provider on the AWS console to manually test things out by unfortunately, whenever I receive text message on my mobile, the sender name still shows a random number assigned by AWS and not the sender id that I configured. I also made sure that the template message approved by TRAI is exactly the same but it did not work either. There are no error logs on AWS either because the message was successfully delivered. Its just that the sender id is not the one that I had configured it to be.
Any help on this topic would be much appreciated. Thanks in advance!
P.S. We registered our template on JIO which is a Telecom provider here in India.
You can't use AWS SNS for this. You have to use AWS Pinpoint if you want to use your specific number. With Pinpoint you can also use short-codes and long-codes and can also configure your messages to be promotional or transactional. You can set your sender id in AWS pinpoint as well. Check the documentation below on how to do that.
https://docs.aws.amazon.com/pinpoint/latest/userguide/channels-sms-awssupport-sender-id.html
It doesn't matter if you have any registration with any telco providers as AWS will use it's own infra to send the messages. So you either have to use 100% AWS solution or 100% telco provider services. You can't mix and match both for SMS sending use-case.
UPDATE:
Well SNS and Pinpoint are 2 different services for 2 different use cases. SNS is only for "notifications" and Pinpoint is like a communication service.
As far as sender-id in SNS is concerned, some countries require it as a hard requirement. You can read more about it in the documentation below:
https://docs.aws.amazon.com/sns/latest/dg/channels-sms-awssupport-sender-id.html
AWS SNS does support using sender IDs together with template and entity IDs for targeting India. If you follow the instructions at https://docs.aws.amazon.com/sns/latest/dg/channels-sms-senderid-india.html, you'll be able to do this.
While subscribing to the S3 notification , I am creating event but when I am selecting the value of Sendto option as SNS topic and providing the SNS topic Url it is throwing error always . The value of the SNS topic url provides by me is arn:aws:sns:us-east-1:123456789012:merge-poc-praveen.
Error Thrown is :
The XML you provided was not well-formed or did not validate against our published schema enter image description here
Try using either objectcreated(all) or put+complete multipart upload Events, but not both at the same time.
I also see a dot at the end of your topic arn - is this correct?
I got the solution for this By following the below mentioned steps :
1)First create Topic in AWS .
2) Attach that topic to SNS then it will work fine .
I got the notification after setting the topic and got the notification in email .
I want to build a pub/sub messaging system into my services that are hosted on Amazon Web Services, and creating SQS queues that subscribe to SNS topics seems like the obvious direction to take, but I can't get it working at all.
So far my code looks for the topics and the queues at startup and creates anything that's missing. This seems to work, I can see the SNS topic and the SQS queues in the AWS management console, and I can see that the queue is subscribed to the topic, but when I publish messages to the topic nothing ends up in the queue.
Even if I manually publish a message using the 'Publish' button in the management console the queue is still empty.
I changed the permissions on both the topic and the queue to 'everyone can do everything' just to eliminate this possibility. My code receives a message ID in response to the publish and there are no errors, every API call returns a 200 (OK) status.
Where can I go from here to figure out why it's not working?
The SNS --> SQS link has a few gotchas:
"Amazon SNS isn't currently compatible with FIFO queues." per the note on their Subscribing an Amazon SQS Queue to an Amazon SNS Topic Tutorial
You have to fiddle with the IAM permissions (see the page on Sending Amazon SNS Messages to Amazon SQS Queues)
You can't send messages to encrypted queues (see their Server-Side Encryption page)
It would definitely have been easier to figure this out if all this info were consolidated into a single page. The killer for me was #3 - perhaps one of these will be the solution to your issue.
A couple of options -
Enable CloudTrail and monitor the logs
View the CloudWatch logs to identify any permissions issues
Open a ticket with AWS support.
Ideally, you wouldn't be creating the resources in your application but instead decouple those into CloudFormation or at a minimum CLI scripts. If you require the ability to dynamically create these resources, using the AWS IoT Message Broker may be a better option since it supports ephemeral messaging resources - http://docs.aws.amazon.com/iot/latest/developerguide/iot-message-broker.html
I had a similar issue with SQS subscriptions. It turned out that if I create the subscription from the SQS editor it works, but if I create it from the SNS creation screen it accepts the message but never forwards it to the queue.
To get more detailed information about specific failures you can turn on
SNS "Delivery status logging".
We have got a strange requirement and we would like to send SMS to our clients based on the assets they are monitoring. Each asset can have 100s of subscribers and there are 1000s of assets so obviously, we can not create one SNS topic per asset. We have the assets and their list of subscribers in a RDS instance on AWS.
Is there anyway with SNS to make the list of its subscribers dynamic, each time we publish a message to it we also supply the list of subscriber this message should be sent to? What are my other options or another AWS service? Lambda maybe? Please advise. thanks
I finally used SNS for this purpose. Each time I need to sent an alert, I call a lambda and supple lambda with the list of subscribers and the message for that asset. Lambda will go ahead, create a new topic, add the subscribers to it, publish the message to it and when everything is done, removes the topic. Works great.
AWS SNS for sending sms had limitation like only for US or North America region. This point should be double checked before making such choice. If your users only from USA - so quite good. In other cases I would recommend to take a look on https://www.nexmo.com/, clickatell.com or Twilio. They provide nice API and can be managed very easy.
I am currently going through the "Quick Start" tutorial for Amazon IoT and I have gotten to the point where I am configuring my rules and test rules. I can see my rules in my aws console under Amazon IoT, along with my thing, cert, and policy. I am using Mosquitto like they suggest for testing it, and I can see my message when I subscribe to my topic.
But I am having an issue that, when I publish a message, I don't see anything in my DynamoDB or the CloudWatch logs from Lambda. And in IoT, I am able to create a resource and see my roles, db table, and lambda function as if it's working. I am keeping to what the tutorial is saying and nothing extra. I can't find any other forum that has discussed Amazon IoT or is having this issue.
Found the solution, it was an error in the AWS Quickstart tutorial.
Look at this thread: https://forums.aws.amazon.com/thread.jspa?threadID=217825&tstart=0
The range timestamp field must be of type String and not Number
The hashKeyValue in the json must be "${topic()}" instead of "${topic(3)}"