Data plane events, as opposed to management events, are not monitored by CloudTrail out-of-the box. But, CloudTrail can be configured so to monitor these events.
We will use this capability in order to direct these events into an SQS queue, from which SkyFormation can pull them at near real-time latency.
Configure CloudTrail and CloudWatch Events to monitor data events
In order to enable this monitoring capability -
Go to a CloudTrail's trail configuration
Under "Data events", click edit, under S3 tab, check the boxes for the S3 buckets you'd like to monitor (or check checkbox for All S3 buckets to monitor all exisiting and future buckets). Select which actions to monitor (Read, Write).
Repeat the process for the Lambda functions under the "Lambda" tab
Create an SQS queue that will be the target of the above events. We will configure it as a target in the next steps.
- Go to CloudWatch Events, and create a new rule -
- Events Source is "Event Pattern", for service "Simple Storage Service (S3)" and another rule for "Lambda", Event Type is "All Events"
- Targets - add a target of "SQS queue", and select the queue created in step #4
- Continue by clicking "Configure Details"
- Give it a meaningful name, i.e. "CloudTrail Data Events", keep the checkbox of state enabled, and click "Create rule"
Verify the configuration is working by forcing some event to occur (i.e. downloading an object from a monitored S3 bucket), and verify it is present in the queue
Configure SkyFormation's AWS account to monitor the pipeline
- Configure SkyFormation to monitor this queue by adding its URL to the AWS Account credentials -
- Login to SkyFormation instance
- Go to Settings -> Accounts -> Edit the AWS Account
- Under Sqs-Url set the URL of the SQS queue created at step #4 (and used in step #5.2)
- Click Save
- Click "Status" on the AWS Account, and verify that the endpoint "cloud-watch-events-sqs" is started (or click "Start" to start it up)
- Verify that the credentials given to the user/access key that were provided to SkyFormation has permission to read and write on the above SQS queue.