Overview
This guide provides Terraform configuration examples for setting up the AWS infrastructure required for Meter’s SIEM integration. You’ll create a Kinesis Data Stream and IAM role that allows Meter to securely write security events to your AWS account.Prerequisites
- Terraform installed (version 1.0 or later recommended)
- AWS account with permissions to create IAM roles, policies, and Kinesis streams
- AWS credentials configured for Terraform (via environment variables, AWS CLI, or IAM role)
- Basic familiarity with Terraform and AWS IAM concepts
Use cases
- Automate SIEM integration infrastructure deployment across multiple AWS accounts
- Maintain infrastructure-as-code for audit and compliance requirements
- Quickly replicate SIEM setup for dev, staging, and production environments
- Version control your security integration configuration
Minimal configuration
This minimal example creates the required AWS resources with secure defaults.Variables
Define these variables in your Terraform configuration:Provider configuration
Kinesis Data Stream
Create a Kinesis stream to receive events from Meter:IAM role for Meter
Create an IAM role that Meter can assume to write to your Kinesis stream:IAM policy for Kinesis write access
Create a policy that grants write permissions to the Kinesis stream:Attach policy to role
Outputs
Export the values needed for Dashboard configuration:Configuration options
Kinesis stream settings
Parameter | Type | Default | Description |
---|---|---|---|
name | string | Required | Name of the Kinesis stream |
shard_count | number | 1 | Number of shards (each shard: 1 MB/sec in, 2 MB/sec out) |
retention_period | number | 24 | Data retention in hours (24-8760) |
stream_mode | string | ”PROVISIONED” | Use “PROVISIONED” for predictable costs, “ON_DEMAND” for variable traffic |
shard_level_metrics | list | See example | CloudWatch metrics to enable for monitoring |
IAM role configuration
Parameter | Type | Required | Description |
---|---|---|---|
meter_service_role_arn | string | Yes | ARN of Meter’s service role (provided by Meter) |
external_id | string | Yes | Random secret string (64+ characters recommended) |
Advanced configuration
On-demand Kinesis stream
For unpredictable event volumes, use on-demand mode:Enhanced monitoring with CloudWatch alarms
Add CloudWatch alarms to monitor integration health:Server-side encryption
Enable encryption at rest for compliance:VPC endpoints for private connectivity
Route Kinesis traffic through your VPC:Integration with Kinesis Firehose
Forward events to S3 for long-term storage:Deployment steps
-
Generate an external ID:
Save this value securely (e.g., AWS Secrets Manager, 1Password).
-
Create a
terraform.tfvars
file: -
Initialize Terraform:
-
Review the plan:
-
Apply the configuration:
-
Capture the outputs:
-
Configure in Meter Dashboard:
- Use the output values to configure the SIEM integration in Dashboard
- See Configuring SIEM integration for step-by-step instructions
Best practices
Security
- Store external ID securely: Never commit the external ID to version control. Use Terraform variables with
sensitive = true
and store the value in AWS Secrets Manager or a secure secrets management tool. - Enable encryption: Use KMS encryption for streams containing sensitive security data.
- Least privilege: Only grant
PutRecord
andPutRecords
permissions, not full Kinesis access. - Enable CloudTrail: Log all API calls to your Kinesis stream and IAM role for audit purposes.
Cost optimization
- Right-size shards: Start with 1 shard and monitor
IncomingBytes
andWriteProvisionedThroughputExceeded
metrics. Add shards only when needed. - Optimize retention: The default 24-hour retention is sufficient if you’re consuming events in real-time. Longer retention increases costs.
- Use on-demand carefully: On-demand mode is convenient but can be more expensive for consistent, high-volume streams.
Operational
- Tag resources: Add consistent tags for cost tracking and resource management.
- Monitor metrics: Enable shard-level metrics and set up CloudWatch alarms for proactive monitoring.
- Test before production: Deploy to a test environment first and send test events to validate the configuration.
- Document your setup: Keep a record of your Terraform module version, external ID rotation schedule, and any customizations.
Troubleshooting
Terraform apply fails with “AccessDenied”
Cause: Your AWS credentials lack permissions to create IAM roles or Kinesis streams. Solution: Ensure your Terraform execution role has permissions foriam:CreateRole
, iam:CreatePolicy
, kinesis:CreateStream
, etc.
Integration shows “Unauthorized” in Dashboard
Cause: The IAM role trust policy or external ID is misconfigured. Solution:- Verify
var.meter_service_role_arn
is the correct ARN provided by Meter - Ensure the
external_id
in Terraform exactly matches what you entered in Dashboard - Check the IAM role was created successfully:
aws iam get-role --role-name MeterSIEMIntegrationRole
Kinesis stream throttling errors
Cause: Event rate exceeds your provisioned shard capacity. Solution:- Increase
kinesis_shard_count
(each shard adds 1 MB/sec write capacity) - Or switch to on-demand mode:
stream_mode = "ON_DEMAND"
- Monitor
WriteProvisionedThroughputExceeded
metric
High AWS costs
Cause: Over-provisioned shards or long retention periods. Solution:- Review your actual event volume in CloudWatch metrics
- Reduce
kinesis_shard_count
if utilization is low - Decrease
kinesis_retention_hours
if you don’t need long-term buffering - Consider archiving to S3 with Firehose instead of extended Kinesis retention
Related resources
- SIEM integration technical overview
- Configuring SIEM integration in Dashboard
- Terraform AWS Provider documentation
- AWS Kinesis Data Streams pricing