A Terraform Module to pipe alerts from Lacework via AWS Eventbridge to an AWS S3 bucket with Lacework.
Creates resources in AWS and Lacework to pipe alerts from Lacework via AWS Eventbridge to an AWS S3 bucket.
The flows goes as so:
Lacework -> AWS Eventbridge -> AWS SQS -> AWS Lambda function -> AWS S3 bucket
The terraform module will create the following in your AWS account
- AWS EventBridge Event Bus
- AWS EventBridge Event Rule
- AWS SQS Queue
- AWS IAM role for Lambda function
- AWS Lambda function to move JSON from SQS to S3
- AWS S3 bucket to store the Alert JSON
- Lacework event bridge alert channel
NOTE: You still need to attach a Lacework alert rule to the alert channel to route alerts to the channel.
Install the Lacework CLI, create an API Key and configure the CLI with the API key. Install the AWS CLI and configure a profile.
Name | Version |
---|---|
aws | >= 3.0 |
lacework | ~> 2.0 |
Name | Version |
---|---|
aws | >= 3.0 |
lacework | ~> 2.0 |
No modules.
Name | Description | Type | Default | Required |
---|---|---|---|---|
aws_eventbridge_event_bus_name | The name of the AWS EventBridge to be created | string |
"Lacework_Alerts_Event_Bus" |
no |
aws_eventbridge_event_rule_name | The name of the AWS EventBridge rule to be created | string |
"Lacework_Alerts_Event_Rule" |
no |
aws_s3_bucket_name | The name of the S3 bucket to be created | string |
n/a | yes |
aws_sqs_queue_name | The name of the SQS queue to be created | string |
"Lacework_Alerts_SQS_Queue_Name" |
no |
lacework_eventbridge_alert_channel_name | The name of the Lacework alert channel to be created | string |
"Alerts to AWS S3 via EventBridge" |
no |
lacework_profile | The Lacework CLI profile to be used to authenticate with Lacework | string |
"default" |
no |
No outputs.
- Create an event bridge integration
- Create a new Lambda function based on the
hello-world
blueprint. Copy the code from index.js into the new function - Edit the SQS Access Policy to enable the Lambda execution role to access it
{
"Sid": "__receiver_statement",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::<AWS_ACCOUNT_ID>:role/service-role/<LAMBDA_EXECUTION_ROLE_NAME>"
},
"Action": [
"SQS:ChangeMessageVisibility",
"SQS:DeleteMessage",
"SQS:ReceiveMessage",
"SQS:GetQueueAttributes"
],
"Resource": "arn:aws:sqs:<YOUR_AWS_REGION>:<AWS_ACCOUNT_ID>:<SQS_QUEUE_NAME>"
}
- Create a new S3 bucket where alerts will be sent.
- In IAM add an inline policy to the Lambda execution role allowing it to write to S3 bucket
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ExampleStmt",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::<BUCKET_NAME>/*"
]
}
]
}