Security Hub Integration
The Guardrails Security Hub integration streams control findings to AWS Security Hub, providing centralized visibility into your security and compliance posture alongside native AWS security services.
Architecture
The integration uses the following AWS services:
| Service | Purpose |
|---|---|
| SNS | Receives control state change notifications from Guardrails. |
| SQS | Queues findings for processing. |
| Lambda | Transforms Guardrails notifications into Security Hub finding format and imports them. |
| ElastiCache (Memcached) | Caches finding state to avoid duplicate imports. |
| CloudWatch | Monitoring and alerting for the integration Lambda. |
| VPC | Network connectivity for Lambda to reach Security Hub endpoints and Memcached. |
Data Flow
- Guardrails generates a
control_updatednotification when a control changes state. - The notification is published to the integration SNS topic.
- An SQS queue buffers the notification.
- A Lambda function processes the notification:
a. Checks Memcached for duplicate/stale findings.
b. Transforms the notification into AWS Security Hub finding format (ASFF).
c. Calls the Security Hub
BatchImportFindingsAPI in the managed account. - The finding appears in Security Hub in the managed account.
Limitations
- Event stream only: The integration streams new control state changes. It does not backfill historical alarms.
control_updatedonly: Only control state change events generate findings. Other notification types are ignored.- 90-day expiration: Security Hub findings expire after 90 days if not refreshed. The integration does not refresh findings.
- No snapshot: The integration cannot generate a point-in-time snapshot of all current alarms.
Deployment
Prerequisites
- Python 3.7+
- AWS CLI configured with credentials for the deployment account
- Turbot Guardrails CLI configured
- Guardrails Firehose configured with a watch for
control_updatednotifications
Deployment Location
| Environment | Deploy To |
|---|---|
| Enterprise | The Guardrails Master account |
| SaaS | A separate AWS account with network access to Security Hub endpoints |
Installation
- Clone the Security Hub integration repository.
- Configure the Terraform variables for your environment.
- Run
terraform init && terraform apply. - Configure the Firehose watch to deliver
control_updatednotifications to the integration SNS topic.
IAM Role in Managed Accounts
Each managed account that should receive Security Hub findings needs an IAM role allowing the integration Lambda to call BatchImportFindings. The minimum permissions are:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"securityhub:BatchImportFindings"
],
"Resource": "*"
}
]
}
Lambda Code Updates
When updating the Lambda function code:
- Run
package-lambda.shto create the deployment package. - Update the Lambda function using the AWS CLI:
aws lambda update-function-code \
--function-name turbot-security-hub-integration \
--zip-file fileb://lambda-package.zip
Monitoring
- CloudWatch Logs: Check
/aws/lambda/{function-name}for processing logs. - CloudWatch Metrics: Monitor Lambda invocation count, errors, and duration.
- SQS Metrics: Monitor queue depth to detect processing backlogs.
Decommission
To remove the integration:
terraform destroy
This removes all integration infrastructure (Lambda, SQS, SNS subscription, ElastiCache, VPC resources). It does not remove findings already imported into Security Hub.
Troubleshooting
| Issue | Solution |
|---|---|
| Findings not appearing in Security Hub | Check CloudWatch Logs for the Lambda function. Verify the Firehose watch is configured and delivering events. |
| Access Denied when importing findings | Verify the IAM role in the managed account has securityhub:BatchImportFindings permission. |
| Findings not enabled error | Enable Security Hub in the target account and enable the Guardrails product integration. |
| Lambda timeout | Check VPC configuration. The Lambda needs network access to Security Hub endpoints and the Memcached cluster. |
| Duplicate findings | The Memcached cache should prevent duplicates. Verify the ElastiCache cluster is healthy. |
| Further assistance | Open a Support Ticket |