POST Request in AWS using API-Gateway
following is my integration request mapping template in API Gateway
#set($head = $input.params('anotherTest')))
#set($myValues = ["abc", "pqr"])
#if($myValues.contains($head))
Action=SendMessage&MessageBody=$input.body
#else
#set($context.responseOverride.status = 403)
{"message_fail": $head}
#end
everything works fine if i only use action as :
Action=SendMessage&MessageBody=$input.body
but IF i use an if-else condition as above, i am getting Access denied error with 200 Ok return code:
{
"Error": {
"Code": "AccessDenied",
"Message": "Access to the resource https://sqs.region.amazonaws.com/account123/myqueue is denied.",
"Type": "Sender"
},
"RequestId": "blah-blah-12345"
}
Here “anotherTest” is also defined in method request with –> “Required=True”
i Also tried giving full access on SQS+ PowerUser+ KMSFull access and trust policy has lambda and SQS both but no luck.
Also, SQS Access policy is completely open to receive message from anywhere.
any help is much appreciated