AWSAmazon Managed Streaming for KafkaMessaging

aws_msk_cluster cost estimation

A managed Apache Kafka cluster. Priced per broker-hour by instance type, plus EBS storage per GB-month and data transfer.

An aws_msk_cluster is a managed Apache Kafka deployment. Two distinct flavors with different pricing:

MSK Provisioned (the default): you provision broker count and instance type. Pricing has three parts.

Broker hours: each Kafka broker is billed per hour by instance type. kafka.m7g.large is $0.211/hour. A standard 3-broker production cluster is ~$462/month for compute alone.

EBS storage: each broker has attached EBS gp3 storage, billed at $0.10/GB-month. A typical 1 TB per broker × 3 brokers = $300/month in storage.

Data transfer: broker-to-broker replication within the cluster is free. Producer/consumer traffic from outside the VPC incurs standard egress rates. Cross-AZ traffic within the VPC is free for in-VPC clients but counts for cross-AZ resources.

MSK Serverless: pay-per-use model with no broker provisioning. Billed per cluster-hour plus per GB written and per GB read. Right for unpredictable or low-baseline workloads. Caps at 200 GB/s total throughput.

Practical cost drivers: broker count (production needs 3 for quorum), per-broker storage (Kafka retention windows directly multiply storage), and cross-AZ data transfer (replication factor 3 doubles or triples inter-AZ traffic).

c3x reads broker_node_group_info for instance type and count, ebs_volume_size for storage, and number_of_broker_nodes.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "aws_msk_cluster" "events" {
  cluster_name           = "production-events"
  kafka_version          = "3.7.x"
  number_of_broker_nodes = 3

  broker_node_group_info {
    instance_type = "kafka.m7g.large"
    client_subnets = aws_subnet.private[*].id

    storage_info {
      ebs_storage_info {
        volume_size = 1000
      }
    }

    security_groups = [aws_security_group.msk.id]
  }

  encryption_info {
    encryption_in_transit {
      client_broker = "TLS"
      in_cluster    = true
    }
  }
}

Pricing dimensions

What you actually pay for when you provision aws_msk_cluster.

DimensionUnitWhat's being charged
Broker hoursper broker per hourPer-broker rate based on instance type. Multiplied by number_of_broker_nodes.
$0.211/hour for kafka.m7g.large in us-east-1
EBS storage per brokerper GB-monthgp3 storage per broker. Multiplied by broker count.
$0.10/GB-month
MSK Serverless clusterper cluster per hourMSK Serverless flavor: per-cluster fee plus throughput-based charges.
$0.75/hour
MSK Serverless data writtenper GBProducer traffic to a Serverless cluster.
$0.10/GB
MSK Serverless data readper GBConsumer traffic from a Serverless cluster.
$0.05/GB
Cross-AZ data transferper GBReplication and consumer traffic crossing AZs. Not free even within the same VPC.

Optimization tips

Common ways to reduce aws_msk_cluster cost without changing the workload.

Use Graviton brokers (kafka.m7g, kafka.t3g)

10-20%

Graviton-based broker instances are 10-20% cheaper than equivalent Intel sizes with similar Kafka throughput. Switching kafka.m5.large to kafka.m7g.large saves about $20/month per broker.

Use Tiered Storage for long retention

Up to 75% on storage

MSK Tiered Storage moves older log segments to S3 transparently. Per-GB cost drops from $0.10 (EBS) to ~$0.025 (S3). Right for workloads with multi-day or multi-week retention.

Right-size broker count

Per-broker cost

Minimum is 1 broker; production typically uses 3 for replication. More than 3 only if you need higher throughput or partition count. Each additional broker is full-cost.

Consider MSK Serverless for low-baseline workloads

Workload-dependent

MSK Serverless has higher per-GB cost but no fixed broker bills. For workloads with sustained throughput below ~10 MB/s, Serverless is cheaper than provisioned.

Set short retention for non-essential topics

Storage proportional to retention

Default Kafka retention is 7 days. For ephemeral topics (cache invalidation, ephemeral events), 24 hours is plenty. Lower retention means lower storage requirement, smaller volumes.

FAQ

MSK vs self-managed Kafka on EC2?

MSK is roughly 30-40% more expensive than equivalent self-managed Kafka but eliminates significant operational burden (cluster management, upgrades, monitoring, failover). For teams without dedicated Kafka operators, MSK usually pays for itself.

Provisioned or Serverless?

Provisioned: predictable workloads above ~10 MB/s sustained. Lower per-GB cost at high volumes. Serverless: variable workloads, occasional bursts, infrequent use. No cluster sizing. Higher per-GB cost but no fixed broker fees.

Does c3x include cross-AZ data transfer?

MSK clusters replicate across AZs by default. Cross-AZ traffic is usage-based; specify in c3x-usage.yml if your workload has high cross-AZ producer/consumer traffic.

What about MSK Connect?

MSK Connect (managed Kafka Connect) is a separate resource (aws_mskconnect_connector) with per-MCU-hour pricing. c3x estimates it independently when declared.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including aws_msk_cluster.