Search code examples
amazon-web-servicesboto3amazon-cloudtrailaws-event-bridge

EventBridge responseElements too large


EventBridge/CloudTrail pass the below json string to my lambda function when the results get too long. Is there anyway to view the responseElements like paginators or NextToken?

"responseElements":{
    "omitted":true,
    "originalSize":175918,
    "reason":"responseElements too large"
}

I'm using the following EventBridge pattern

{
  "source": ["aws.ec2"],
  "detail-type": ["AWS API Call via CloudTrail"],
  "detail": {
    "eventSource": ["ec2.amazonaws.com"],
    "eventName": ["RunInstances"]
  }
}

Solution

  • This is a limitation of CloudTrail, so at this time it's not be possible to pass that information from CloudTrail if it exceeds 100KB.

    Potential work-around that may be useful to others with this message is to create an EventBridge rule to track EC2 instance state changes. So instead of monitoring the api call runinstances look for instances changing into the state running triggering from that as this should have a smaller response.

    https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatch-Events-tutorial-CloudWatch-Logs.html