I'm facing a problem when trying to deploy my stack via AWS SAM CLI
. I'm using the SAM simplified template which I package and deploy.
All I want is to create an SQS queue and implicitly create an API Gateway that will just put the payload into the queue.
This is what I tried so far (the piece of code where I define Queue + Api):
MyProjectQueue:
Type: AWS::SQS::Queue
Properties:
Events:
MyProjectApi:
Type: Api
Properties:
Path: /myproject/push
Method: post
All good when I run sam validate
and sam package
, but it fails when I run sam deploy
. To fetch the error I used aws cloudformation describe-stack-events --stack-name myproject-stack
STACKEVENTS
MyProjectQueue-CREATE_FAILED-2018-10-30T16:33:29.764Z
MyProjectQueue
CREATE_FAILED
Encountered unsupported property Events AWS::SQS::Queue arn:aws:cloudformation:eu-west-1:<MY_AWS>:stack/myproject-stack/<GIUD>
myproject-stack 2018-10-30T16:33:29.764Z
It clearly says that Events it's not supported for AWS::SQS::Queue
. But this works for Lambdas (resource type AWS::Serverless::Function
) which is the reason why I tried this way.
But, if possible, I'd like to avoid having a lambda between the gateway and the queue.
Is it possible to define an API Gateway directly for the SQS Queue? And How?
Thanks!
Event
. Seems like I'll have to follow this path and define the API GW as a Resource then. Cheers for the suggestion about exporting the definition – Haircut