Managing Amazon Msk
AWSOfficialPublished by AWS
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides domain expertise for operating Amazon MSK Provisioned clusters. It covers performance troubleshooting, consumer lag diagnosis, storage management, cluster sizing, client configuration, and CloudWatch monitoring. It distinguishes between Standard and Express broker architectures, providing specific workflows for maintenance, topic management, and MSK Replicator setup. The skill also includes guidance on integrating with S3 via Streaming Tables and Data Delivery for General Purpose S3.
What it does
- Provides configuration patterns for Kafka producers and consumers.
- Offers workflows for managing MSK cluster configurations and custom domain names.
- Includes a sizing script for determining broker counts and instance types.
- Details procedures for MSK Replicator setup for DR and cross-account replication.
- Outlines monitoring and alerting strategies using CloudWatch metrics.
- Guides the setup of Streaming Tables and Data Delivery for S3.
When to use it
- When configuring or tuning Kafka clients for MSK connectivity.
- When sizing a new MSK cluster or choosing between Standard and Express brokers.
- When troubleshooting performance issues, consumer lag, or storage constraints.
- When setting up cross-cluster replication or disaster recovery.
- When integrating MSK with S3 for data lake or streaming table requirements.
Advantages
- Provides clear decision frameworks for Standard vs. Express broker types.
- Includes automated sizing logic via provided scripts.
- Centralizes operational procedures for common MSK maintenance tasks.
- Offers specific guidance for complex configurations like custom advertised listeners.
Usage examples
- “How do I choose between MSK Standard and Express brokers for my workload?”
- The agent will guide you through the size-and-choose-cluster.md reference and run the msk_sizing.py script to compare costs and performance characteristics.
- “My consumer lag is increasing, what should I check?”
- The agent will provide a troubleshooting workflow based on troubleshoot-consumer-lag.md, covering rebalance issues and consumer group health.
- “How do I configure a custom domain name for my MSK brokers?”
- The agent will explain how to use the custom.advertised.listeners configuration property as detailed in configure-cluster.md.
- “What are the recommended producer settings for MSK?”
- The agent will provide the table of recommended values for settings like linger.ms, batch.size, and acks from the configure-clients.md reference.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/aws/managing-amazon-msk/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip managing-amazon-msk.zip -d .agents/skills
Documentation by AWS
Amazon MSK
Overview
Domain expertise for operating Amazon MSK Provisioned clusters with Standard and Express broker types. Covers performance troubleshooting, consumer lag diagnosis, storage management, cluster sizing, client configuration, and CloudWatch monitoring.
Execute commands using available tools from the AWS MCP server when connected — it provides sandboxed execution, audit logging, and observability. When the MCP server is not available, fall back to the AWS CLI or shell as needed.
Standard brokers use customer-managed EBS volumes for storage. You choose instance types (kafka.m5/m7g families), provision EBS, and manage storage scaling.
Express brokers use instance types prefixed with express.m7g and are the default recommendation for almost all MSK workloads — they typically cost less, not just less effort. Up to 3x ingress per broker (MSK Express broker types) means fewer brokers for the same load, and storage is billed per GB-hour on data actually retained rather than provisioned up front on EBS that cannot shrink. They also scale 20x faster, rebalance partitions 180x faster (Intelligent Rebalancing), recover 90% quicker (MSK Express broker types), and have no maintenance windows. Express brokers have NO customer-managed EBS — do NOT recommend EBS expansion or provisioned throughput for Express clusters. Express brokers enforce fixed replication factor of 3 and min.insync.replicas=2. See size-and-choose-cluster.md for the full Standard vs Express decision framework.
Which Workflow Do You Need?
Determine the broker type first: aws kafka describe-cluster-v2 --cluster-arn <arn>. Check Provisioned.BrokerNodeGroupInfo.InstanceType — if it starts with express., it is an Express cluster.
| Customer Intent | Reference |
|---|---|
| High CPU, high latency, slow cluster, traffic shaping | troubleshoot-performance.md |
| Consumer lag increasing, rebalance storms, stuck consumer groups | troubleshoot-consumer-lag.md |
| Disk filling up, retention planning, tiered storage | manage-storage.md |
| Choosing Standard vs Express, sizing a cluster, partition limits, broker count, monthly cost | size-and-choose-cluster.md |
| Producer/consumer configuration, IAM/SCRAM/TLS auth | configure-clients.md |
Creating/applying MSK configurations (server.properties); custom domain names on brokers via custom.advertised.listeners (advertised listeners, static/custom bootstrap endpoint) — validation rules, apply/rollback, scaling; migrating from the dynamic per-broker kafka-configs.sh override to the static property | configure-cluster.md |
| Client-side connectivity for a custom domain: NLB + ACM certificate + Route 53 fronting, TLS handshake/termination, mTLS through an NLB, cross-zone load balancing | configure-clients.md (Custom Domain Name Connectivity section) |
Create, update, delete, list, or describe Kafka topics; when to use the native topic APIs / CfnTopic vs. a Kafka admin client | manage-topics.md |
| MSK Replicator setup, migration, DR, active-active/active-passive, cross-account replication, self-managed-to-MSK or MSK-to-MSK, loop-prevention/topic-naming behavior | msk-replicator.md |
Replication throughput per partition, how many partitions a replicator needs, why replicator scaling isn't increasing throughput, replicator quotas (topics, ingress, record size), ReplicationLatency/MessageLag/ReplicatorThroughput | msk-replicator.md (Size partition count section) |
| Setting up monitoring, dashboards, alarms | monitor-and-alarm.md |
| Full CloudWatch metric list (Standard or Express) | Prefer monitor-and-alarm.md for strategic recommendations and how to interpret metrics, only search documentation if you need to understand a metric not included in this reference file (MSK Standard CloudWatch Metrics, MSK Express CloudWatch Metrics) for full list |
| Rolling restart impact, patching, maintenance resilience | maintenance-operations.md |
| Deliver streaming data to Apache Iceberg tables on S3 Tables with low cost in a fully managed service (Streaming Tables) — setup, IAM, schema, create/update/delete/list/describe channels | streaming-tables.md |
| Deliver topic data to S3 bucket as JSON/ByteArray/String objects with low cost in a fully managed service (Data Delivery for General Purpose S3 buckets) — setup, IAM, output key templates, create/update/delete/list/describe channels | data-delivery-for-general-purpose-s3.md |
| Build a lakehouse / data lake from Kafka; make streaming data queryable in Athena | streaming-tables.md |
| Alternative to Kafka Connect S3 Sink or Amazon Data Firehose for MSK; zero-ops streaming delivery to S3 | data-delivery-for-general-purpose-s3.md |
| Streaming Tables / Data Delivery CloudWatch metrics and alarms, DLQ errors, failed deliveries, channel state transitions, freshness lag | streaming-tables-troubleshooting.md |
| "Can I use Streaming Tables / Data Delivery on MSK Serverless / Standard brokers?" — eligibility routing | streaming-tables.md (answer is always: Express brokers only, use Firehose, Flink, or Kafka Connect for Standard and Serqverless - Firehose integration for Amazon MSK) |
| What are the current supported Kafka versions for MSK? | Supported Apache Kafka versions |
| Does MSK support KRaft clusters, and how do I migrate between ZooKeeper and KRaft mode clusters? | zk-to-kraft-migration.md |
| What are the current quotas for MSK Express (ingress, egress, partitions, broker count, etc.)? | MSK Express Quotas |
| What are the current quotas for MSK Standard (partitions, broker count, etc.)? | MSK Standard Quotas, and MSK Standard best practices for partition count limits |
| What broker-level configuration changes can I make on MSK Express or Standard brokers? | MSK Configuration |
Available scripts
scripts/msk_sizing.py— MUST be run for any sizing question (broker count, instance choice, cost). Prices from the live AWS Pricing API when AWS credentials withpricing:GetProductsare available, and falls back to an embeddedus-east-1snapshot when they are not, so it runs with or without credentials. See size-and-choose-cluster.md for the required workflow and script reference.
Guardrail — where this skill's own files live (MCP vs local install)
This skill can be loaded two ways, and they resolve the skill's own bundled files — the references/ documents and the scripts/ files
from different places. Determine how the skill was loaded before you read a reference or run a script:
Loaded through the AWS MCP
retrieve_skilltool call. The skill is not installed on the local filesystem; its reference files and scripts do not exist on disk. You MUST fetch each reference or script through the sameretrieve_skilltool by passing thefileparameter (for example,file="references/configure-clients.md"orfile="scripts/msk_sizing.py"), and run a script from the content that tool returns. Do NOTfile_readthese paths from the local or working directory, and do NOT search the filesystem for them — they are not there, and any local file that happens to match the name is unrelated to this skill.Installed locally (the skill lives in a local skills directory such as
.claude/skills/managing-amazon-msk/,~/.claude/skills/managing-amazon-msk/, or.kiro/skills/managing-amazon-msk/). Read references and run scripts from the local skill directory using the relative paths shown throughout this documentation.
This distinction applies only to the skill's own packaged files. Every artifact
created during a session or supplied by users are read from and written to
the user's working directory regardless of how the skill was loaded. Never
fetch or write customer data through retrieve_skill.
Common Workflows
Create/apply Amazon MSK configurations and set custom domain names — creating an Amazon MSK configuration (server.properties with the fileb:// real-newline requirement), applying it with update-cluster-configuration, and setting broker custom domain names via custom.advertised.listeners: see configure-cluster.md. For the NLB/certificate/DNS connectivity that fronts a custom domain, see configure-clients.md.
Files
- ATTRIBUTION.mdAdded by AutoGineer918 B
- LICENSELicence file added by AutoGineer9.9 KiB
- NOTICELicence file added by AutoGineer67 B
- SKILL.md11.0 KiB
- references/configure-clients.md13.3 KiB
- references/configure-cluster.md11.3 KiB
- references/data-delivery-for-general-purpose-s3.md15.7 KiB
- references/maintenance-operations.md13.0 KiB
- references/manage-storage.md8.5 KiB
- references/manage-topics.md7.0 KiB
- references/monitor-and-alarm.md15.4 KiB
- references/msk-replicator.md18.9 KiB
- references/size-and-choose-cluster.md17.2 KiB
- references/streaming-tables-troubleshooting.md5.3 KiB
- references/streaming-tables.md19.5 KiB
- references/troubleshoot-consumer-lag.md11.5 KiB
- references/troubleshoot-performance.md9.3 KiB
- references/zk-to-kraft-migration.md728 B
- scripts/msk_sizing.pyScript62.6 KiB
references/configure-cluster.md
Configure MSK Brokers and Clusters
Broker-level and cluster-level configuration for Amazon MSK Provisioned clusters: creating and applying MSK configurations (server.properties), and setting custom domain names on the brokers with custom.advertised.listeners.
For the client-side layer that fronts a custom domain (NLB, ACM certificate, Route 53, TLS handshake, mTLS), see configure-clients.md. For per-instance-size thread tuning and durability defaults, see size-and-choose-cluster.md.
Note: The AWS MCP server is the recommended way to run the AWS API interactions in this reference (
kafkadescribe/update calls,kafka-configs.sh, etc.) — it provides sandboxed execution, audit logging, and observability. It is not a hard requirement; when the MCP server is unavailable, fall back to the AWS CLI or shell.
Custom Domain Names (custom.advertised.listeners)
Use a custom domain name (e.g., b-1.example.com) when clients need a static, customer-controlled endpoint that survives cluster recreation, migration, or DR failover, or must align with organizational DNS/naming. MSK brokers otherwise advertise AWS-generated addresses (b-1.<cluster>.<id>.kafka.<region>.amazonaws.com) that change when a cluster is recreated. This section covers the cluster configuration that sets the advertised address; the NLB / certificate / DNS layer that must exist first is in configure-clients.md.
Set it with the custom.advertised.listeners configuration property
Recommended approach: a single, validated, cluster-wide MSK configuration property. Set it once and MSK resolves it per broker and reapplies it automatically as the cluster scales. This replaces the per-broker kafka-configs.sh --alter --add-config advertised.listeners=... override.
Works in both ZooKeeper and KRaft mode. The per-broker
advertised.listenersoverride could not be applied on KRaft clusters;custom.advertised.listenersworks on both. If asked whether custom domains are possible on a KRaft cluster, the answer is yes — via this property. Do NOT recommend the per-brokerkafka-configs.shoverride or self-managed Kafka as the current solution, and do NOT claim custom domains are impossible on KRaft.Provisioned only (Standard and Express brokers). NOT supported on MSK Serverless (Serverless does not support custom broker configurations). If a custom domain is required on Serverless, use a Provisioned cluster.
Reversible and IaC-friendly. Flows through CloudFormation, CDK, Terraform, and the CLI.
Value format:
custom.advertised.listeners=<LISTENER>://<hostname>:<port>Example (three-broker IAM cluster fronted by an NLB on ports 9001-9003):
custom.advertised.listeners=CLIENT_IAM://b-{broker_id}.example.com:9000+{broker_id}Rules that MSK validates (synchronously, before any change)
Client listeners only. Valid values are the client-facing listeners:
CLIENT,CLIENT_SECURE,CLIENT_SECURE_PUBLIC,CLIENT_SASL_SCRAM,CLIENT_SASL_SCRAM_PUBLIC,CLIENT_IAM,CLIENT_IAM_PUBLIC. Internal listenersREPLICATIONandCONTROLLERare rejected — this protects the listeners MSK manages. A rejectedREPLICATION://...config is not a syntax problem with the+separator or offset; it is rejected because internal listeners are not allowed.Listener must be bound (active) on the cluster. Name the client listener that matches the cluster's authentication type (e.g.,
CLIENT_IAMon an IAM cluster). Specifying an unbound listener (e.g.,CLIENT_SECUREon an IAM-only cluster) is rejected, and the error lists the valid client listeners for your cluster.{broker_id}template + uniqueness.{broker_id}is replaced with each broker's numeric ID at apply time. In a port expression like9000+{broker_id}, the broker ID is added to the base port, so broker 1 -> 9001, broker 2 -> 9002, broker 10 -> 9010 (9000 is just an example base). Each broker's resolvedhost:portmust be unique.{broker_id}may appear in the hostname, the port, or both — so a shared hostname with a per-broker port (CLIENT_IAM://example.com:9000+{broker_id}) is valid, but a shared hostname AND shared port for every broker fails validation. The resulting ports must match the TLS listeners provisioned on your NLB.
Apply workflow
Put the property in a file (leave
{broker_id}literal — MSK resolves it per broker; do not substitute IDs yourself). It can live alongside other broker properties in a single configuration revision.Create/update the configuration, passing the file with
fileb://(notfile://) so the CLI reads it as bytes and base64-encodes it — passing inline or withfile://is fragile because of the{broker_id}braces:aws kafka create-configuration --name custom-domain-iam \ --server-properties fileb://custom-domain-config.txt(For an existing configuration, add the property and create a new revision with
update-configuration.)Apply the returned configuration ARN and revision to the cluster:
aws kafka update-cluster-configuration \ --cluster-arn <arn> \ --configuration-info arn=<config-arn>,revision=<revision> \ --current-version <current-cluster-version>MSK validates, resolves the pattern per broker, and applies it via a rolling restart.
Track the rollout with
describe-cluster-operation-v2(or theDescribeOperationAPI): states goUPDATE_IN_PROGRESS->UPDATE_COMPLETE/SUCCESSorUPDATE_FAILED/FAILED.
Auditability: Ensure CloudTrail is logging MSK API calls (
kafka:UpdateClusterConfiguration,kafka:UpdateConfiguration) so configuration changes are auditable.
Rollout failure recovery. If a broker fails to start, the rollout halts at that broker and the remaining brokers keep their previous configuration — the cluster is not left half-configured, and no recreation is needed. Fix the property (common cause: the resolved host:port isn't resolvable/reachable/trusted via your NLB+DNS+cert) and re-apply.
Reverting. Fully reversible: remove custom.advertised.listeners from the configuration (new revision without it) and re-apply. MSK reverts the listener to its original AWS-generated advertised address via a rolling restart. Only the advertised address of the named listener is affected — REPLICATION, authentication, multi-VPC (CLIENT_IAM_VPCE), and PrivateLink connectivity are unaffected.
Migrate from the dynamic per-broker override to the static property
Existing custom-domain setups configured the advertised address dynamically, per broker, with kafka-configs.sh --alter --add-config advertised.listeners=[...] — repeated on every broker and re-run whenever a broker was added, hand-preserving the REPLICATION/REPLICATION_SECURE (and any multi-VPC) entries each time. Migrating to the static custom.advertised.listeners property removes that per-broker toil, adds up-front validation, works on KRaft, and flows through IaC. The networking layer you already built (NLB, DNS, certificate) stays exactly as is — only how the advertised address is configured changes.
Capture the current pattern. On each broker, read the existing dynamic value so you can reproduce it exactly:
kafka-configs.sh --bootstrap-server $BS --entity-type brokers --entity-name <broker-id> \ --command-config client.properties --all --describe | grep advertised.listenersNote the client listener name and the
host:porteach broker advertises (e.g.,CLIENT_SASL_SCRAM://b-1.example.com:9001) and confirm it fits a{broker_id}template such asb-{broker_id}.example.com:9000+{broker_id}.Include only the client listener in the property. Unlike the dynamic override — where you had to include and preserve
REPLICATION/REPLICATION_SECURE(and multi-VPC) entries yourself —custom.advertised.listenersmanages only the named client listener, and MSK preserves the internal, multi-VPC (CLIENT_IAM_VPCE), and PrivateLink listeners for you. Do NOT putREPLICATION/CONTROLLERin the property (they are rejected).Match the existing address for a zero-cutover migration. Choose the template so each broker's resolved
host:portequals what it already advertises. Then the advertised address does not change and clients keep connecting with no cutover. If you deliberately change the pattern, clients cut over on their next metadata refresh — build and verify the new NLB listeners, target groups, and DNS records first (see configure-clients.md).Apply via the configuration, not
kafka-configs.sh. Addcustom.advertised.listenersto a new MSK configuration or, if you already manage one for the cluster, add it and create a new revision withupdate-configuration; then apply withupdate-cluster-configuration(see Apply workflow above). From now on, manage the advertised address only through the MSK configuration, not with per-broker dynamic overrides.Clear any stale dynamic override and verify the effective value. A per-broker dynamic config can take precedence over broker configuration in Kafka, so after applying, confirm the effective
advertised.listenerswith the--describecommand from step 1. If a leftover dynamic override remains, delete it withkafka-configs.sh --alter --entity-type brokers --entity-name <broker-id> --delete-config advertised.listeners— do this only after step 3 guarantees the resolved address is identical, so removal changes nothing for clients.Confirm and finish. Ensure the operation reaches
SUCCESS(describe-cluster-operation-v2) and clients still connect (kafka-topics.sh --list --bootstrap-server <custom-bootstrap>). Going forward MSK reapplies the property to new/replaced brokers automatically, so you no longer re-run the per-broker override (you still add NLB/DNS entries for new brokers).
KRaft note: if the dynamic override was never an option because the cluster is in KRaft mode, the static property is the supported path and works on KRaft. The migration is reversible — remove the property and re-apply to return to the AWS-generated address.
Scaling and broker replacement (cluster side)
When you add brokers (or a broker is replaced during automated healing), MSK automatically applies the configuration to the new broker, resolving {broker_id} for its ID — nothing to do on the cluster side. The networking layer does NOT auto-scale, however: you must add the corresponding NLB listener, target group, and DNS record for each new broker. See configure-clients.md.
Prerequisite: the networking/trust layer must exist first
Applying this property changes what the brokers advertise, so clients cut over to the custom domain on their next metadata refresh. If the NLB, DNS, and trusted certificate are not already in place, connected clients cannot reconnect. Build that layer first and follow the safe two-phase cutover documented in configure-clients.md.
References
Amazon MSK simplifies configuring custom domain names — the
custom.advertised.listenersproperty
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs an MCP server, Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- AWS
- Publisher
- AWS (Official)
- Source
- aws/agent-toolkit-for-aws · plugins/aws-data-analytics/skills/managing-amazon-msk · commit 0a218f8
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- NOTICE (added by AutoGineer from NOTICE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- aws/agent-toolkit-for-aws
AutoGineer is not affiliated with or endorsed by AWS or AWS.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download managing-amazon-msk.zip