简体   繁体   中英

Sending message from webpage hosted in S3 to SQS queue

I'm trying to figure out a way to do my first project on AWS.

I have this page http://nlprism.sciusanalytics.com/ hosted in an S3 bucket. After the user writes a URL and posts it, I want to pass this URL as a message to an SQS queue, which will then call a Lambda function. What's the appropriate way to do the post to the SQS queue from the page? I thought about embedding some javascript in the page which sends the message to SQS when the user clicks submit, but then I would need to hardcode my SQS credentials in the webpage, so that's likely not the way to go.

If you create an IAM user, and the only permissions it has is to post messages to that one queue, then it really doesn't matter if someone discovers your credentials in your javascript - the worst they can do is post messages to your queue, which they can do already because it doesn't appear that your page has any authentication - so if someone was looking to pollute your queue, they can do it thru your webpage (even if you manage to hide the credentials), or by accessing the queue directly.

If you had a server behind your webpage, you would have more options to hide the credentials, but even then, since the page isn't protected, anyone can post as often as they want right thru your page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM