I'd like to setup some monitoring for capturing access denied and unauthorized operation errors in my AWS account. I'd like to capture all of these events across different AWS services but have run into some issues. I've initially setup some a couple of cloud watch rules that trigger a basic lambda function but I'm not capturing the events I'm looking for. Below are a couple of the rules events that trigger a Lambda function (ideally I'd filter these down from capturing all events once I get this working).
{
"source": ["aws.cloudtrail"],
"detail-type": ["AWS API Call via CloudTrail"],
"detail": {
"eventSource": ["cloudtrail.amazonaws.com"]
}
}
// All cloud watch
{
"source": [
"aws.cloudwatch"
]
}
I've been testing with the AWS CLI, making calls to resources I don't have access too e.g. :
- aws dynamodb list-tables
- aws ec2 describe-instances
- List item
I'm getting the correct errors in response from the CLI but I'm not seeing these events being propagated to the Lambda (I am seeing other non errors triggering the Lambda though).
Do I have to configure this more narrowly or am I missing a step for collecting these errors?
Thanks for the help