I would like to send a message to a SQS queue in r...
# aws
b
I would like to send a message to a SQS queue in response to an API Gateway POST. I see lots of examples around subscribing to sqs queues but don’t see sendmessage or put type commands in any of the examples. What would the syntax look like to send a message to a queue like this? Thanks
Copy code
const queue = new aws.sqs.Queue("dataqueue");
m
Hey Kevin — I haven’t used SQS myself before, but I suspect this is a place where you’d use the AWS SDK (which Pulumi provides for you, in the
aws
package) to send that message — so something like:
Copy code
const queue = new aws.sqs.Queue("dataqueue");
...

// And then in your POST handler
const sqs = new aws.sdk.SQS();
sqs.sendMessage({
    ...the properties of the request
});
The docs for the SQS class of the AWS SDK are here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/SQS.html
You should be able to access the properties of the
queue
resource using
.get()
methods (e.g.,
queue.arn.get()
, etc.), which will allow you to to pass regular strings for the argument to
sendMessage
.
b
Thanks Chris, I will take a look
👍 1