1

According AWS it should be possible to send events directly to AWS EventBridge via API Gateway: https://aws.amazon.com/blogs/compute/capturing-client-events-using-amazon-api-gateway-and-amazon-eventbridge/

The preceding API Gateway AWS integration enables API Gateway to send the events to EventBridge without using compute services, such as Lambda or Amazon EC2. The integration and IAM execution role enable API Gateway to call the EventBridge PutEvents API to do this.

I tried to implement this with REST API Gateway:

aws api gateway integration request

But when calling the endpoint, I am receiving:

{ "__type": "UnknownOperationException" }

I read from other posts that you need to have correct request headers included (Cloudwatch Logs PutLogEvents action fails with com.amazon.coral.service#UnknownOperationException when called from API Gateway and com.amazon.coral.service#UnknownOperationException when triggering CodeBuild from API Gateway). I have tried this with:

'Content-Type: application/x-amz-json-1.1'
'X-Amz-Target: AWSEvents.PutEvents'

Payload for the API is:

{
   "Entries":[
      {
         "Source":"maksim.test",
         "Detail":"{ 'name': 'Maksim', 'action': 'testing'}",
         "Resources":[
            "resource1",
            "resource2"
         ],
         "DetailType":["Custom Maksim test event"]
      }
   ]
}

But still same error. Any ideas what I am doing wrong?

Maksim Luzik
  • 5,863
  • 4
  • 36
  • 57
  • Did you map the request as shown in the linked article? In particular you see `AWSEvents.PutEvents`, not `EventBridge`, see also https://docs.aws.amazon.com/eventbridge/latest/APIReference/API_PutEvents.html . – luk2302 Dec 01 '22 at 12:55
  • Thanks for the link, you were right that the Target header was wrong and I had wrong format of JSON I was sending, but even after fixing themI am still getting same error :( I updated the header and added payload in the original question. – Maksim Luzik Dec 01 '22 at 13:30

0 Answers0