/aws-data-analytics:troubleshoot-spark-jobfrom aws-data-analytics
Diagnoses and fixes failed or slow Apache Spark workloads on AWS Glue, EMR on EC2, EMR Serverless, and EMR on EKS using the analyze_spark_workload MCP tool for deep analysis and optional code fix recommendations.
Ships in aws-data-analytics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Diagnose failed or degraded Apache Spark workloads on AWS Glue, Amazon EMR on EC2, Amazon EMR Serverless, and Amazon EMR on EKS. Uses the SageMaker Unified Studio Spark Troubleshooting MCP server (spark-troubleshooting) to analyze job logs, error traces, and resource metrics. Optionally follows up with the Spark Code Recommendation MCP server (spark-code-recommendation) to generate targeted code fixes - but only when the diagnosis identifies a code-level fix.
Constraints:
analyze_spark_workload (the spark-troubleshooting server) FIRST as the primary diagnostic tool for every troubleshooting request. It provides deeper analysis than AWS job run APIs alone.spark_code_recommendation (the spark-code-recommendation server) standalone or as a first step. It is a FOLLOW-UP ONLY: invoke it after analyze_spark_workload has produced a diagnosis AND that diagnosis identifies a code-level fix AND the user wants code changes. Calling it without a prior analyze_spark_workload diagnosis produces lower-quality root cause analysis.spark_code_recommendation when the diagnosed fix is configuration-only (e.g. memory, partition, or resource tuning with no code change). Present the configuration fix directly.analyze_spark_workload's natural chaining into code recommendation over an explicit standalone spark_code_recommendation call.aws emr describe-step, aws emr describe-cluster, aws glue get-job-run, aws emr-serverless get-job-run, aws emr-containers describe-job-run, or any AWS CLI command as a diagnostic step. The MCP tool provides all the information needed.aws emr list-clusters, aws emr-serverless list-applications, aws emr-containers list-virtual-clusters, aws glue list-jobs, aws glue get-job-runs, or any discovery/list API. Ask the user for identifiers instead.If the user has not provided the required identifiers, ask for them. Do NOT call AWS CLI, AWS APIs, list-jobs, get-job-runs, or any other discovery API to look them up. Do NOT attempt to list recent failures or guess which job failed. Ask the user directly and wait for a response.
A bare "EMR" (without EC2, cluster, or step; Serverless or application; or EKS or virtual cluster) is NOT platform-distinguishing. If the user says only "EMR" (for example, "my EMR job failed"), ask whether it is EMR on EC2, EMR Serverless, or EMR on EKS before requesting identifiers; the three platforms use different identifiers.
AWS Glue: job name and job run ID (hex string starting with jr_)
EMR on EC2: cluster ID (format: j-<alphanumeric>, typically 12-13 chars after the prefix) and step ID (alphanumeric string starting with s-)
EMR Serverless: application ID (16-char alphanumeric string starting with 00) and job run ID (16-char alphanumeric string starting with 00)
EMR on EKS: virtual cluster ID (lowercase alphanumeric string, e.g. 6aycqwm1iryxff42j7sf1qix0) and job run ID (alphanumeric string, e.g. 00000003891im4vqfb6)
Optional for all platforms: additional context (error message, user observations, what was tried)
Call analyze_spark_workload with the platform type and parameters. Valid platform_type values: GLUE, EMR_EC2, EMR_SERVERLESS, EMR_EKS. For EMR_EKS, pass virtual_cluster_id and job_run_id. The tool returns:
Present the analysis results clearly:
If - and only if - the diagnosis includes code-level issues: when the user has already asked for code fixes, go directly to Phase 3 and call spark_code_recommendation for the code change rather than writing it by hand; ask first only if the user has not requested code changes. If the fix is configuration-only, do not offer code recommendations; present the config change directly.
Enter this phase ONLY when Phase 1/2 diagnosed a code-level issue (inefficient transformations, missing optimizations, incorrect API usage) AND the user wants fixes. Call spark_code_recommendation with the analysis results and the user's Spark code. The tool generates specific code changes with before/after examples, configuration tuning recommendations, and explanations. Present the tool's code changes; do not substitute a hand-written fix for them.
Note: analyze_spark_workload may automatically invoke spark_code_recommendation when the error category is eligible - prefer this natural chaining over calling spark_code_recommendation independently, which produces lower-quality root cause analysis. If analyze_spark_workload did not return code recommendations, call spark_code_recommendation after the diagnosis. Never call spark_code_recommendation as the entry point to this skill.
Provide a concise summary: root cause confirmed, fixes applied or recommended, configuration changes needed, whether a re-run is expected to succeed, and any follow-up monitoring recommended.
glue my-etl-job jr_abc123 -- Skip platform prompts| Platform | Trigger Keywords |
|---|---|
| AWS Glue | glue job, glue etl, glue spark |
| EMR on EC2 | emr ec2, emr ec2 cluster, emr step |
| EMR Serverless | emr serverless, emr-s, serverless spark |
| EMR on EKS | emr on eks, emr eks, emr virtual cluster, emr-containers |
If the user's input matches a trigger keyword in the table above, use that platform directly. The fallback (asking which platform) applies only when no platform-distinguishing keyword is present. A bare "EMR" does not match any EMR row, so ask. If the input matches trigger keywords for more than one platform, ask the user which platform the failing job runs on before proceeding.
sagemaker-unified-studio-mcp action permissions. Permissions are required only when tools make downstream API calls (e.g., accessing Glue, EMR, or CloudWatch logs). If a tool call fails with AccessDeniedException, see the IAM setup docs.00 (e.g., 00g5gmlv894uvl09), not the same format as EMR-EC2 step IDs.emr-containers API), not by an EKS cluster name. Do NOT call aws emr-containers list-job-runs or kubectl to find them; ask the user.--read-timeout 180 is intentional -- log fetching and analysis for large jobs can take several minutes.| Error | Cause | Fix |
|---|---|---|
| MCP server failed to load | Configuration or credentials issue | Verify JSON syntax and AWS credentials |
| AccessDeniedException on log fetch | IAM role lacks required permissions | Add the missing permissions (see IAM setup docs) |
| Job run not found | Incorrect job name, run ID, or wrong region | Verify identifiers with the user |
| Analysis returns no root cause | Logs unavailable or job succeeded | Confirm the job is in a failed state; check log retention settings |
Detailed guidance: references/error-handling.md
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
21 skills in this plugin
/amazon-opensearch-serviceGuides migration, provisioning, search, log-analytics, trace-analytics, and Agentic AI Assistant workflows for Amazon OpenSearch Service and Serverless across six capabilities — migration (Solr/ES/self-managed into AOS/AOSS, schema/query translation, sizing, cutover); provisioning (domain + AOSS lifecycle, upgrades, FGAC, monitoring); search (vector / semantic / hybrid / RAG with Bedrock); log-analytics (PPL, OSI, anomaly detection, Dashboards); trace-analytics (OTel spans, service maps, Data Prepper); ai-assistant (natural language data exploration, incident investigation, root cause analysis). Triggers on OpenSearch, AOS, AOSS, Elasticsearch, Solr, vector/k-NN/semantic/hybrid search, RAG, log analytics, PPL, trace analytics, ISM, FAISS, HNSW, Migration Assistant, UltraWarm, OR1, query my data, analyze logs, investigate errors, root cause analysis./authoring-mwaa-workflowAuthors and deploys MWAA workflow artifacts: Python Airflow DAGs for provisioned environments or YAML workflow files for Serverless. Covers operator selection, timeout design, retry strategy, scheduling, failure notifications, idempotency, and MWAA Serverless schema compliance. Deploys the artifact (S3 DAG upload or Serverless CreateWorkflow/UpdateWorkflow), creates an environment inline when approved, and redeploys fixes, then optionally hands off to testing-mwaa-workflow. Triggers on: create a DAG, write a pipeline, build a workflow, orchestrate tasks, Airflow DAG, data pipeline, schedule a job, deploy a DAG, deploy a workflow, YAML workflow. Not applicable to converting or migrating existing DAGs between provisioned and serverless (conversion is out of scope), running or smoke-testing a deployed workflow (handled by testing-mwaa-workflow) or diagnosing a failed run (handled by debugging-mwaa-workflow).
/connecting-to-data-sourceCreate and troubleshoot AWS Glue connections to JDBC databases (Oracle, SQL Server, PostgreSQL, MySQL, RDS), Redshift, Snowflake, and BigQuery. Gathers connection hints from user, discovers existing connections and RDS/Redshift candidates, registers credentials in Secrets Manager or IAM DB auth, configures VPC, and tests. Triggers on: connect to database, set up Glue connection, register data source, connect to Snowflake/BigQuery/RDS, connection timeout, test connection, troubleshoot connection. Do NOT use for moving data (use ingesting-into-data-lake), creating tables (use creating-data-lake-table), queries (use querying-data-lake), catalog exploration (use exploring-data-catalog), or SaaS (Salesforce, ServiceNow, SAP, MongoDB, Kafka)./creating-data-lake-tableCreate managed Iceberg tables using Amazon S3 Tables (s3tables API namespace) with automatic compaction and snapshot management. Sets up table bucket, namespace, table, schema, Glue catalog registration, partitioning, IAM access control. Triggers on: create table, data lake table, analytics table, structured data storage, S3 Tables, Iceberg, Athena table, partitioning strategy, access permissions. Do NOT use for: importing files (use ingesting-into-data-lake), vector storage (use storing-and-querying-vectors), querying existing tables (use querying-data-lake), or locating existing table (use finding-data-lake-assets)./debugging-mwaa-workflowDiagnoses and root-causes Amazon MWAA workflow failures across Provisioned (Python DAG) and Serverless (YAML workflow) environments. Provisioned uses aws mwaa invoke-rest-api, CloudWatch log groups, and get-environment; Serverless uses aws mwaa-serverless API (GetWorkflowRun, ListWorkflowRuns, GetTaskInstance) and CloudWatch logs. Covers failed runs and tasks, DAGs not appearing, import errors, worker OOM, IAM denials, and dependency drift. Triggers on: DAG failed, task failed, workflow run failed, MWAA error, debug my DAG, why did my workflow fail, DAG not showing up, MWAA import error, requirements failing, worker crashed, serverless run failed. Not applicable to authoring workflows (handled by authoring-mwaa-workflow), running or smoke-testing a workflow (handled by testing-mwaa-workflow), or CI-CD deploy failures.
/developing-applications-on-managed-service-for-apache-flinkMANDATORY for Flink or Amazon Managed Service for Apache Flink (MSF) questions. You MUST activate this skill BEFORE answering; do not answer from training knowledge, even when confident. MSF has service-specific constraints (KPU model, prohibited checkpoint and parallelism config in app code, the v1/v2 identifier split, two-phase IaC deploys, snapshot lifecycle, Flink 1.x to 2.x migration) that override generic Flink knowledge. Triggers: Flink, MSF, Managed Flink, KinesisAnalytics(V2), KPU, ParallelismPerKPU, savepoint, snapshot, SnapshotMode, operator UID, FlinkKinesisConsumer, KinesisStreamsSource, KafkaSource, EFO, CreateApplication, UpdateApplication, CreateSnapshot, Kryo, RocksDB, EXACTLY_ONCE, watermark, CDC binlog/WAL, AWS/KinesisAnalytics CloudWatch. NOT for choosing a service to land Kafka or Kinesis data in Iceberg: managing-amazon-msk owns Kafka to Iceberg, managing-amazon-kinesis-data-streams owns KDS. Use this skill for the Flink IcebergSink itself.
Other plugins' skills for the same job
npx claudepluginhub aws/agent-toolkit-for-aws --plugin aws-data-analytics