Reputation: 6260
I have a normal monolith app running on Heroku. I would like to use an SQS queue to process some background jobs.
Monolith -> posts to SQS -> SQS holds event & calls -> Monolith -> Confirms processing and deletes event from SQS
I already have an S3 bucket I have configured via the AWS CDK, now I'm trying to figure out to configure an SQS queue which I can also call from the outside (via access_token/key authentication):
// The user I used for S3 uploads
const uploadUser = new iam.User(this, "upload-user", {
userName: "upload-user",
})
// ...Here is some other code to initialize S3 bucket
const bucket = ...
bucket.grantWrite(uploadUser)
// But when creating a queue this does not work
const queue = new sqs.Queue(this, 'linear-sync.fifo')
queue.grant(uploadUser) // errors
Trying to do this gives me an error:
Argument of type 'User' is not assignable to parameter of type 'IGrantable'
Any idea on how to achieve this?
Edit: I ended up abandoning the idea of using a SQS queue, I might come back to it later, but decided to go for redis, it's easier to set up with our current docker-based stack but I might revisit the idea later
Upvotes: 1
Views: 1393
Reputation: 11589
First of all, the Queue.grant
method requires you to list which actions you want to grant access to. If you want to post messages to the queue, you would call Queue.grantSend
.
Now, the reason User
may not be assignable to IGrantable
is because you have mismatched versions of CDK installed. Are you using V1? Are all the CDK modules the same version? Make sure you're not using V1 and V2 together.
Upvotes: 2