npx skills add ...
npx skills add aws/agent-toolkit-for-aws --skill amazon-keyspaces
npx skills add aws/agent-toolkit-for-aws --skill amazon-keyspaces
Provides authoritative compatibility checks, pricing estimates, connection troubleshooting, pre-warming guidance, and infrastructure mutations for Amazon Keyspaces (for Apache Cassandra). Covers LWT/batch operations, secondary indexes, materialized views, capacity modes, TTL, PITR, CDC, auto-scaling, multi-region keyspaces, UDTs, nodetool diagnostics parsing, SQL-to-Cassandra migration, and Cassandra-to-Keyspaces migration scenarios. Agents frequently produce incomplete or incorrect answers about Keyspaces feature support without this skill loaded.
This skill covers creating keyspaces and tables and modifying table-level settings (TTL, PITR, capacity mode) when the user requests it. The agent MUST confirm the action with the user before executing. Do NOT execute any create or modify operation without explicit user confirmation (e.g., "yes", "proceed", "confirmed", "go ahead"). If the user has not confirmed, present the planned action and ask for approval.
aws keyspaces create-keyspaceaws keyspaces create-keyspace --replication-specification replicationStrategy=MULTI_REGION,regionList=[{region=us-east-1},{region=eu-west-1}]aws keyspaces create-table (include partition-key and clustering-key design derived from the user's access patterns)aws keyspaces update-table --add-columns '[{"name":"col_name","type":"text"}]' — non-destructive, no downtime, no data loss. Existing rows get null for the new column.aws keyspaces create-type --keyspace-name <ks> --type-name <name> --field-definitions '[{"name":"field1","type":"text"},...]'aws keyspaces update-table --default-time-to-liveaws keyspaces update-table --point-in-time-recovery-specificationaws keyspaces update-table --capacity-specification (on-demand vs provisioned) — see warnings belowaws keyspaces update-table --encryption-specification type=CUSTOMER_MANAGED_KMS_KEY,kmsKeyIdentifier=arn:aws:kms:... — no downtime or availability loss. Can also switch back to AWS owned key with type=AWS_OWNED_KMS_KEY.aws keyspaces update-table --warm-throughput-specification readUnitsPerSecond=X,writeUnitsPerSecond=Y — sets the minimum instantaneous throughput the table can handle. Use before planned traffic spikes (flash sales, migrations, batch loads). One-time cost based on the delta above natural warm throughput. Also available on aws keyspaces create-table --warm-throughput. Load pre-warming.md for the decision framework and sizing formulas.aws keyspaces update-table --auto-scaling-specification — sets target utilization percentage and min/max capacity units for reads and/or writes. Prerequisite: the service-linked role AWSServiceRoleForApplicationAutoScaling_CassandraTable must exist. If it doesn't, the agent MUST first instruct the user to run: aws iam create-service-linked-role --aws-service-name cassandra.application-autoscaling.amazonaws.com. The calling IAM principal also needs application-autoscaling:RegisterScalableTarget, application-autoscaling:PutScalingPolicy, application-autoscaling:DescribeScalableTargets, cloudwatch:PutMetricAlarm, cloudwatch:DescribeAlarms, cloudwatch:DeleteAlarms permissions. Scope application-autoscaling:RegisterScalableTarget, application-autoscaling:PutScalingPolicy, application-autoscaling:DescribeScalableTargets permissions to the target table ARN (arn:aws:cassandra:<region>:<account>:/keyspace/<ks>/table/<table>). Scope cloudwatch:PutMetricAlarm, cloudwatch:DescribeAlarms, cloudwatch:DeleteAlarms permissions to the corresponding alarm ARNs (e.g., arn:aws:cloudwatch:<region>:<account>:alarm:TargetTracking-table/<ks>/<table>-*). Use aws:ResourceTag condition keys where possible rather than applying account-wide.aws keyspaces update-table --cdc-specification status=ENABLED,viewType=<type> — creates a CDC stream that captures row-level changes. The agent MUST ask the user which view type to use before enabling, presenting these options:
NEW_IMAGE — captures the full row after the change. Best for: event-driven pipelines, downstream sync, materialized views.OLD_IMAGE — captures the full row before the change. Best for: audit trails, compliance logging, undo/rollback scenarios.NEW_AND_OLD_IMAGES — captures both before and after states. Best for: diff-based pipelines, detailed auditing, conflict resolution. Higher CDC consumption cost.KEYS_ONLY — captures only the partition key and clustering key columns. Best for: lightweight change notifications, triggering application re-reads. Lowest cost.
Optional: propagateTags=TABLE copies the table's tags to the CDC stream. Recommend enabling by default.aws keyspaces tag-resource, aws keyspaces untag-resourceWhen creating ANY keyspace or table (aws keyspaces create-keyspace, aws keyspaces create-table, or CQL CREATE KEYSPACE ... WITH TAGS, CREATE TABLE ... WITH TAGS), you MUST include these tags. A create operation without these tags is INCOMPLETE and INCORRECT:
AWS CLI syntax:
--tags key=created_by,value=keyspaces-skill key=generation_model,value={your-model-id}
CQL syntax:
WITH TAGS = {'created_by': 'keyspaces-skill', 'generation_model': '{your-model-id}'}
Example (CLI): --tags key=created_by,value=keyspaces-skill key=generation_model,value=claude-sonnet-4-20250514
Example (CQL): WITH TAGS = {'created_by': 'keyspaces-skill', 'generation_model': 'claude-sonnet-4-20250514'}
Include these tags even if the user does not mention tagging, so that they can identify the resources created via this skill. If the user provides additional tags, append these to their tags rather than replacing them. Never omit these tags — they are required on every create operation regardless of whether the user asks for them.
aws keyspaces update-table --capacity-specification — warn: "Switching between on-demand and provisioned can cause brief throttling while Keyspaces rebalances; apply during low-traffic windows."aws keyspaces restore-table — warn: "Restore creates a new table and takes minutes to hours depending on table size; the source table is unaffected but the new table has no traffic until you cut over."aws keyspaces delete-keyspace — irreversible, cascades to all tablesaws keyspaces delete-table — irreversible, data is lostaws keyspaces delete-type — may break tables and columns referencing the type; data corruption riskaws keyspaces update-table --cdc-specification status=DISABLED — disabling CDC deletes the stream and all unprocessed records are lost permanently. Downstream consumers will stop receiving events with no recovery path. Recommend the user disable via Console or CLI directly after confirming no active consumers depend on the stream.aws keyspaces update-table --client-side-timestamps status=ENABLED — irreversible (cannot be disabled once enabled); recommend the user apply via Console or CLI directly after understanding the implicationsaws keyspaces update-keyspace --replication-specification (adding a new region) — irreversible replication change; cannot remove a region once added. Recommend creating a new multi-region keyspace instead if testing.aws keyspaces update-table --point-in-time-recovery-specification status=DISABLED — consider the recovery-window implications firstWhen refusing, explain why and offer the matching assessment workflow:
"I can't perform [action] because [reason]. I can run an assessment to help you decide. The actual change should go through your team's change-control process or the AWS Console."
Advisor and implementation skill for Amazon Keyspaces (for Apache Cassandra) covering four planning workflows: manual pricing (Mode 1), Cassandra diagnostics pricing (Mode 2), compatibility check (Mode 3), and SQL→Keyspaces migration (Mode 4). Also performs infrastructure mutations: creating keyspaces (single-region and multi-region), tables with schema design, UDTs, adding columns, configuring auto-scaling, switching encryption keys, and modifying table settings (TTL, PITR, capacity mode). Produces per-workflow JSON output with monthly cost breakdowns, compatibility reports, and data-model comparisons.
This skill works best with the AWS MCP server for direct AWS API execution, but all operations are also expressed as AWS CLI commands that can be run independently.
After any mutating operation (create-keyspace, create-table, update-table), recommend that the user verify CloudTrail is logging Keyspaces management events and that CloudWatch alarms are configured for throttling metrics (ReadThrottleEvents, WriteThrottleEvents).
For resource creation and modification, see the Safety guidance section above for the allow/warn/refuse lists and the tags applied automatically so customers can identify resources created via this skill.
The bundled scripts in scripts/ (calculate.ts, parse-cassandra.ts, check-compatibility.ts, generate-pdf.ts) are user-runnable deliverables. When shell access is available, execute them directly. Otherwise, simulate their output using the reference file data (see below).
Mandatory response pattern for every Mode 1-4 invocation:
mode-1-manual-inputs, mode-2-cassandra-diagnostics, mode-3-compatibility, mode-4-sql-migration) in your response.scripts/node_modules/ installed (cd scripts && npm install):".references/mode-*.md) — those tables mirror the rates in assets/data/mcs.json. Do NOT invent rates; reference file tables are the source of truth.✓ Correct pattern:
"Running calculate.ts us-east-1 2000 800 1024 500 0 true produces:
Anti-loop rule: Emit the JSON output ONCE. Do NOT iterate, refine, re-derive, or recalculate. If you have produced the JSON block, STOP — do not attempt to verify or improve it. Move directly to offering the optional PDF report.
✗ Incorrect pattern (MUST NOT use):
"Let me calculate the costs:
- Reads: 2000 r/s × 30 days × 24h × 3600s = 5.184B RRU/month × $0.0000001250 = $648/mo
- Writes: 800 w/s × ... = $1,296/mo ..."
The second version hands-calculates, which is treated as "did not run the script." Same numbers, wrong presentation.
references/mode-*.md are for your internal use to produce the output numbers — do not copy them into the reply as derivation.Check for required tools and warn the user before running any workflow.
Constraints:
scripts/node_modules/ (via cd scripts && npm install), so the user understands what is missing and why it matters.aws configure / ada credentials update)./tmp/keyspaces-*.json so PDF and comparison steps can reuse it.Tool call example (print as text; do not attempt to execute):
Use when the user has no Cassandra cluster or prefers typing numbers directly.
Parameters:
region (required): AWS region code, e.g. us-east-1.reads_per_second (required): integer.writes_per_second (required): integer.avg_row_size_bytes (required): typical 256-4096. Default 1024 only when unknown.storage_gb (required): single-replica compressed storage in GB.ttl_deletes_per_second (optional, default 0).pitr_enabled (optional, default false).Constraints:
region against assets/data/regions.json.npx ts-node command, present JSON output.The command to run this analysis yourself (print this as a fenced bash block with flags resolved):
Required output shape (emit exactly this structure as a ```json code block, filled in with user's inputs):
Load mode-1-manual-inputs.md for the pricing rate table the calculator uses. Offer an optional PDF report (Task 6) after displaying JSON.
Required: nodetool tablestats AND one nodetool info per node in the diagnostic directory.
Optional: nodetool status, DESCRIBE SCHEMA (schema.cql), rowsize output, prepared-statements NDJSON.
Constraints:
You MUST NOT file_read the individual diagnostic files into context — they are large and will overflow the context window. Instead, pass the directory path to parse-cassandra.ts --dir <path>.
You MUST NOT invoke parse-cassandra.ts without tablestats and at least one info file.
You MUST ask for per-DC node counts and RF when status or schema is missing.
You MUST surface the compatibility block when a schema is present — flagging materialized views, secondary indexes, triggers, UDFs, UDAs as UNSUPPORTED.
CREATE MATERIALIZED VIEW, CREATE INDEX, CREATE TRIGGER, CREATE FUNCTION, and CREATE AGGREGATE statement. Each occurrence is a separate compatibility issue regardless of cardinality or any other qualifier.has_issues MUST be true whenever one or more such statements are found. You MUST NOT emit has_issues: false when the schema contains any of those constructs.details.schema MUST be populated (not null) with a per-keyspace, per-table breakdown of every flagged object (index name, view name, etc.), and summary.schema.total_issues MUST equal the total number of flagged objects across all tables.Worked example — ecommerce keyspace schema containing orders_by_customer (materialized view), orders_status_idx (secondary index), and customers_email_idx (secondary index):
You MUST follow the Script execution model: announce, print the command, present JSON output.
The command to run this analysis yourself:
Load mode-2-cassandra-diagnostics.md for the intake table and cassandra-capture-commands.md for capture commands.
Parameters: at least one of --schema <path.cql> or --prepared <path.ndjson>.
Constraints:
query_patterns.ttl_tables as informational, not an issue.status: "UNSUPPORTED" and a migration_recommendation.The command to run this analysis yourself:
Load mode-3-compatibility.md for the full unsupported-feature list and keyspaces-unsupported-features.md for migration guidance per feature.
Generate three data models, price each, recommend.
Three modeling strategies (you MUST price ALL THREE):
Constraints:
calculate.ts commands (one per strategy), present comparative JSON.The commands to run this analysis yourself (three invocations, one per strategy):
Load mode-4-sql-migration.md for SQL→CQL mapping and the comparison table.
Constraints:
The command to run this yourself:
Load pdf-reporting.md for multi-input and label syntax.
NoNodeAvailableException / HeartbeatException / PerConnectionRequestExceededLoad connection-troubleshooting.md. Covers application.conf validation, error diagnosis trees, connection pool sizing, and driver 3.x vs 4.x differences. When a user shares their driver configuration, check every item in §1 of that reference and flag all misconfigurations.
WriteThrottleEvents / ReadThrottleEvents / capacity planningLoad pre-warming.md. Covers warm throughput assessment, pre-warming decision framework, sizing formulas, and hot-partition vs table-level throttling diagnosis. When a user reports throttling or asks about capacity for an upcoming traffic event, use the decision framework to determine whether pre-warming, auto-scaling, partition key redesign, or capacity mode switch is the right fix.
Region not found: <region>Wrong region code or Keyspaces unavailable there. Check assets/data/regions.json.
parse-cassandra.ts exits with "Usage: …"--tablestats or --info missing. Recapture or use Mode 1.
has_issues: false but user expected findingsOnly features in keyspaces-unsupported-features.md are flagged. ALLOW FILTERING, TRUNCATE, and most data types are supported.
Do not file_read large diagnostic files into context. Pass the directory to parse-cassandra.ts --dir <path> instead.
Cassandra credentials or SigV4 plugin missing. See security-considerations.md.
npm install fails in scripts/Node < 18 or stale lockfile. Delete scripts/node_modules/ and scripts/package-lock.json, rerun.
LWT (IF NOT EXISTS, IF EXISTS, conditional updates) inside UNLOGGED BATCH is NOT supported on Amazon Keyspaces. LWT statements must be run individually (standalone). LOGGED BATCH is also NOT supported on Keyspaces. Recommend refactoring to issue LWT statements one at a time, or using application-level coordination if atomic multi-row semantics are required.
references/: mode-1-manual-inputs, mode-2-cassandra-diagnostics, mode-3-compatibility, mode-4-sql-migration, pdf-reporting, keyspaces-unsupported-features, cassandra-capture-commands, security-considerations.This skill can be invoked directly, or it can be entered from the aws-database-selection parent skill after that skill has run a requirements interview and produced a requirements.json artifact. When you see a backtick-wrapped path matching aws_dbs_requirements/*/requirements.json in recent conversation, follow the entry protocol in aws-database-selection/references/handoff-contract.md:
file_read.aws-database-selection/references/workload-primary-artifact.schema.json. If malformed or unreadable, tell the user and proceed without it.workload_primaries.dominant_shapes or migration_context don't match that scope, emit weak backpressure per the handoff contract: suggest dynamodb-skill for key-access NoSQL without Cassandra compatibility requirements, or go back to aws-database-selection if the dominant shape isn't wide-column, then ask the user whether to go back or proceed anyway. Do not silently misuse the artifact.All user-facing output from this skill follows the markdown-primitives-only formatting convention in the handoff contract: bold labels, backticks for paths and enum values, bullet lists for alternatives, no ASCII art or box-drawing characters.