AGENT SKILL

kinesis-firehose-troubleshooter

Diagnoses Amazon Kinesis Data Firehose delivery stream failures via a systematic 8-symptom decision tree: delivery to S3 fails (bucket deleted, KMS key policy, bucket region mismatch), data transformation Lambda fails (Lambda timeout, exception, resource policy), delivery lag (buffering hints too large, Lambda slow, throttling), data format conversion fails (incorrect JSON, Hive SerDe mismatch for Parquet/ORC), delivery to OpenSearch fails (cluster unreachable, auth failure, circuit breaker), delivery to Redshift fails (COPY command failure, staging bucket issue), and latest destinations (Firehose to Snowflake, HTTP endpoint, Splunk delivery). Maps each symptom to root cause via diagnostic commands and specific fixes. Emits ROOT_CAUSE_FOUND with a fix plan, NEED_MORE_INFO with the next diagnostic, or ESCALATE with the escalation path. Use when Firehose is failing to deliver, lagging, transforming incorrectly, or a downstream destination returns errors.

License 许可
Apache-2.0
最近更新
2026-09-24
Stars
★ 4
Forks
0

01 前言 Front Matter

name
kinesis-firehose-troubleshooter
license
Apache-2.0
metadata
{ "tags": "kinesis, firehose, analytics, troubleshoot, delivery-stream, lambda, opensearch, redshift, diagnostic", "phase": "2", "author": "Jacky Chan — AWS Community Builder", "domain": "aws-cloudops", "family": "Analytics", "version": "0.1.0", "keywords": "Kinesis, Kinesis Data Firehose, delivery stream, delivery to S3 fails, delivery lag, data transformation Lambda, Lambda processing, data format conversion, Parquet, ORC, Hive SerDe, OpenSearch delivery, Redshift COPY, Snowflake delivery, HTTP endpoint delivery, Splunk HEC, circuit breaker, buffering hints, KMS key policy, staging bucket", "task_type": "troubleshoot", "complexity": "high", "entry_point": "false", "skill_class": "capability", "when_to_use": "Diagnosing a Kinesis Data Firehose delivery stream that is failing to deliver, lagging, transforming incorrectly, or one of the downstream destinations returns errors. Covers the eight primary symptom categories: delivery to S3 fails, data transformation Lambda fails, delivery lag, data format conversion fails (Parquet/ORC), delivery to OpenSearch fails, delivery to Redshift fails, and latest destinations (Firehose to Snowflake, HTTP endpoint, Splunk). Use when CloudWatch shows DeliveryToS3.Success dropping, Firehose logs show Lambda transformation errors, ORC/Parquet conversion produces 0-byte objects, the OpenSearch destination returns 429s, or the Redshift COPY command fails.", "requires_llm": "true", "verdict_shape": "ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE", "lifecycle_status": "active", "invocation_schema": "Input: either (a) a delivery-stream-name with observed symptom (delivery-to-s3-fails / lambda-fails / delivery-lag / format-conversion-fails / opensearch-fails / redshift-fails / latest-destination-fails), optionally with a destination type (s3 / opensearch / redshift / snowflake / http-endpoint / splunk), OR (b) live-account diagnostic output from describe-delivery-stream, get-metric-statistics, filter-log- events, etc. Output: deterministic DIAGNOSIS block per stream - SYMPTOM/ROOT_CAUSE/EVIDENCE/LAYER_CHECK/FIX/ VERDICT - where VERDICT is ROOT_CAUSE_FOUND (cause identified + fix actionable), NEED_MORE_INFO (specific next diagnostic cited), or ESCALATE (requires AWS Support or out-of-band action).", "supports_pipeline": "true", "activation_triggers": "Firehose delivery fails, Firehose delivery lag, Firehose to S3 fails, Firehose to OpenSearch fails, Firehose to Redshift fails, Firehose to Snowflake fails, Firehose HTTP endpoint fails, Firehose Splunk delivery fails, Firehose Lambda transformation fails, DeliveryToS3.Success drops, DeliveryToS3.DataFreshnessSec high, data format conversion fails, Parquet conversion 0 bytes, ORC SerDe mismatch, Firehose circuit breaker, OpenSearch 429, Redshift COPY fails, Splunk HEC token invalid, Firehose KMS denied, bucket region mismatch" }
description
Diagnoses Amazon Kinesis Data Firehose delivery stream failures via a systematic 8-symptom decision tree: delivery to S3 fails (bucket deleted, KMS key policy, bucket region mismatch), data transformation Lambda fails (Lambda timeout, exception, resource policy), delivery lag (buffering hints too large, Lambda slow, throttling), data format conversion fails (incorrect JSON, Hive SerDe mismatch for Parquet/ORC), delivery to OpenSearch fails (cluster unreachable, auth failure, circuit breaker), delivery to Redshift fails (COPY command failure, staging bucket issue), and latest destinations (Firehose to Snowflake, HTTP endpoint, Splunk delivery). Maps each symptom to root cause via diagnostic commands and specific fixes. Emits ROOT_CAUSE_FOUND with a fix plan, NEED_MORE_INFO with the next diagnostic, or ESCALATE with the escalation path. Use when Firehose is failing to deliver, lagging, transforming incorrectly, or a downstream destination returns errors.
compatibility
Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). No AWS CLI required for offline diagnosis. Live- account troubleshooting uses aws firehose describe-delivery- stream, list-tags-for-stream, list-delivery-streams, start- delivery-stream-encryption, stop-delivery-stream-encryption, aws logs filter-log-events, aws lambda get-function, get-policy, invoke, aws s3api head-bucket, get-bucket-location, aws opensearch describe-domain, describe-domain-health, aws...

02 资源文件 19

03 SKILL.md 正文

Kinesis Data Firehose Troubleshooter

Mindset

A Firehose delivery stream is a four-stage pipeline: ingest (the PutRecord API or Kinesis Stream source), transform (optional Lambda processing), convert (optional format conversion to Parquet/ORC via Glue catalog), and deliver (the destination: S3, OpenSearch, Redshift, Snowflake, HTTP endpoint, Splunk). Most "Firehose failing" tickets are one stage failing silently while the others report healthy. Diagnose the stage first, then the destination-specific config.

  • The 5-layer health check is the upstream gate. Firehose does not surface all failures as delivery-stream ACTIVE status changes; a Lambda transform or destination can fail while the stream stays green. Diagnose by layer: source, transform, convert, deliver, observability.
  • CloudWatch metrics are per-destination. DeliveryToS3.Success, DeliveryToOpenSearch.Success, DeliveryToRedshift.Success are separate metrics. Verify the metric matching the configured destination, not just DeliveryToS3.Success.
  • describe-delivery-stream is the source of truth. It returns the full destination config, Lambda ARN, buffering hints, and the S3 backup bucket. The console shows a summary; the API returns the exact JSON the service is using.

Quick navigation

You want to... Go to
Run the 5-layer health check first (recommended) Step 1
Diagnose delivery to S3 fails Step 2
Diagnose data transformation Lambda fails Step 3
Diagnose delivery lag (high DataFreshness) Step 4
Diagnose data format conversion fails (Parquet/ORC) Step 5
Diagnose delivery to OpenSearch fails Step 6
Diagnose delivery to Redshift fails Step 7
Diagnose latest destinations (Snowflake / HTTP / Splunk) Step 8
Map symptom to root cause quickly Appendix A
Avoid misdiagnosis pitfalls Anti-Patterns

STRICT output contract

Every diagnosis MUST emit the exact DIAGNOSIS block with all fields populated (no empty fields, no omitted sections, no reordering). All five LAYER_CHECK lines (Source, Transform, Convert, Deliver, Observability) are mandatory - even when the failure is destination- specific.

Verdict-specific rules:

  • ROOT_CAUSE_FOUND -> ROOT_CAUSE names a single specific cause; EVIDENCE cites at least one failing API signal or metric; FIX is actionable CLI.
  • NEED_MORE_INFO -> ROOT_CAUSE is "Pending diagnosis - <what is known>"; NEXT_STEP cites the exact next command.
  • ESCALATE -> ESCALATION_PATH names the recipient and the out-of-band action required.
DIAGNOSIS: <reference>
DELIVERY_STREAM: <stream-name>
DESTINATION: <s3 | opensearch | redshift | snowflake | http-endpoint | splunk | lambda>
SYMPTOM: DeliveryToS3Fails | LambdaFails | DeliveryLag | FormatConversionFails | OpenSearchFails | RedshiftFails | LatestDestinationFails
ROOT_CAUSE: <specific cause cited>
EVIDENCE:
  - <diagnostic signal 1>
  - <diagnostic signal 2>
LAYER_CHECK:
  - Source: <PASS | FAIL - reason>
  - Transform: <PASS | FAIL - reason | N/A>
  - Convert: <PASS | FAIL - reason | N/A>
  - Deliver: <PASS | FAIL - reason>
  - Observability: <PASS | FAIL - reason>
FIX:
  - <action 1 with CLI snippet>
  - <action 2 ...>
VERIFICATION:
  - <command to confirm fix>
VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE
NEXT_STEP: <if NEED_MORE_INFO, the specific next diagnostic>
ESCALATION_PATH: <if ESCALATE, the recommended path>

Critical rules at a glance

  1. Run the 5-layer health check FIRST. Before any destination-specific diagnosis, confirm: (1) source is feeding records, (2) Lambda transform (if any) is not erroring, (3) format conversion (if any) is producing non-zero output, (4) destination is reachable and accepting writes, (5) CloudWatch logging is enabled so you have evidence.
  2. Verify the per-destination metric. DeliveryToS3.Success is irrelevant when the destination is OpenSearch. Use the metric matching the configured destination.
  3. describe-delivery-stream returns the live config. The console may lag or show stale state; the API returns the actual JSON Firehose is using.
  4. Lambda transforms cap output at 6 MB. A record that grows during transformation (enrichment, JSON expansion) can exceed the cap and be dropped silently to S3 backup.
  5. DataFreshness is the lag indicator. A spike in DeliveryToS3.DataFreshnessSec means the destination is not keeping up with ingestion. Buffering hints and Lambda duration are the usual culprits.

NEVER (top 5)

  • NEVER diagnose a Firehose failure without first running the 5-layer health check. Most "delivery fails" tickets are coverage gaps in the transform Lambda, the KMS key policy, or the destination reachability.
  • NEVER assume the delivery-stream status ACTIVE means records are being delivered. ACTIVE only means the stream config is accepted; per-record delivery failures are surfaced via CloudWatch metrics and S3 backup, not status.
  • NEVER confuse a Lambda transform timeout with a Firehose bug. Firehose invokes the transform with the configured buffer (1-3 MB or 60-900 sec); a Lambda slower than the buffer cadence produces backpressure, not a Firehose failure.
  • NEVER assume Parquet/ORC conversion is working because objects land in S3. Conversion can produce 0-byte objects if the input JSON is malformed or the Glue table schema does not match the data. Always verify object size, not just object count.
  • NEVER emit VERDICT: NEED_MORE_INFO without a NEXT_STEP naming a specific diagnostic command. Generic phrases like "investigate further" are not acceptable.

Expert heuristic

  • If DeliveryToS3.Success drops to 0 instantly after a config change, the failure is IAM, KMS, or bucket policy (Step 2). Check CloudTrail for AccessDenied on s3:PutObject or kms:GenerateDataKey.
  • If DeliveryToS3.DataFreshnessSec spikes without a drop in Success, the failure is buffering hints or Lambda duration (Step 4). The destination eventually catches up; data is just delayed.
  • If Parquet objects land but query engines return empty results, the failure is SerDe / Glue schema mismatch (Step 5). The bytes are written but unreadable.
  • If only OpenSearch destination fails with 429 Too Many Requests, the failure is OpenSearch write throttling or the Firehose circuit breaker (default: 5 minutes of sustained writes). Scale the OpenSearch cluster or raise the circuit-breaker window.
  • If Redshift COPY fails consistently at the same step, the failure is column-count mismatch, encoding, or the staging-bucket IAM grant (Step 7). Look in STL_LOAD_ERRORS.
  • If Snowflake / HTTP endpoint / Splunk destinations fail, the failure is usually credentials, network reachability, or the endpoint's auth model (Step 8) - these do not exercise S3 KMS or Lambda layers.

Pre-flight: data requirements

Moved verbatim → references/diagnostic-commands.md § "Pre-flight: data requirements". Load when: starting a diagnosis — the required-inputs table and the malformed-input NEED_MORE_INFO block.

Process - Diagnostic decision tree (apply in order)

Step 0: Expert knowledge - non-obvious Firehose behaviors

Moved verbatim → references/advanced-patterns.md § "Step 0: Expert knowledge - non-obvious Firehose behaviors". Load when: a behavior seems non-obvious — buffered Lambda invocation, 6 MB response cap, OpenSearch circuit breaker, staging-bucket IAM, update-destination VersionId.

Step 1: The 5-layer Firehose health check (run FIRST)

Before any destination-specific diagnosis, confirm all five layers. A failing layer invalidates all downstream diagnosis.

Layer 1 - Source (records are arriving):

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.[DeliveryStreamStatus,DeliveryStreamType,Source.KinesisStreamSourceConfiguration]' --output table
aws cloudwatch get-metric-statistics --namespace AWS/Firehose \
  --metric-name IncomingBytes --dimensions Name=DeliveryStreamName,Value=<stream-name> \
  --start-time $(date -u -v-15M +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --period 60 --statistics Sum --output table

For Kinesis-stream source, also verify the source stream is alive:

aws kinesis describe-stream-summary --stream-name <source-stream-name> \
  --query 'StreamDescriptionSummary.[StreamStatus,RetentionPeriodHours,OpenShardCount]' --output table

Layer 2 - Transform (Lambda is not erroring):

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].<destination-block>.ProcessingConfiguration' --output table
aws cloudwatch get-metric-statistics --namespace AWS/Lambda \
  --metric-name Errors --dimensions Name=FunctionName,Value=<lambda-function-name> \
  --start-time $(date -u -v-15M +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --period 60 --statistics Sum --output table
aws logs filter-log-events --log-group-name /aws/lambda/<lambda-function-name> \
  --filter-pattern "ERROR" --start-time $(date -u -v-15M +%s)000 --output table

Layer 3 - Convert (format conversion producing non-zero output):

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].ExtendedS3DestinationDescription.DataFormatConversionConfiguration' --output table
aws s3api list-objects-v2 --bucket <bucket> --prefix <prefix> \
  --query 'Contents[*].[Key,Size,LastModified]' --output table | head -20

Layer 4 - Deliver (destination reachable and accepting writes):

aws cloudwatch get-metric-statistics --namespace AWS/Firehose \
  --metric-name <DeliveryToS3|DeliveryToOpenSearch|DeliveryToRedshift>.Success \
  --dimensions Name=DeliveryStreamName,Value=<stream-name> \
  --start-time $(date -u -v-15M +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --period 60 --statistics Average --output table

For OpenSearch, also verify domain health:

aws opensearch describe-domain-health --domain-name <domain-name> \
  --query 'DomainStatus.[ClusterConfig.DedicatedMasterEnabled,ClusterConfig.InstanceType,ClusterHealth] ' --output table

Layer 5 - Observability (logging is enabled):

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].<destination-block>.CloudWatchLoggingOptions' --output table
aws logs describe-log-groups --log-group-name-prefix /aws/kinesisfirehose/<stream-name> --output table

Flags: Enabled: false on CloudWatch logging means you are blind to per-record errors. Enable before debugging further.

If any layer fails, fix the layer FIRST. Most Firehose failures resolve when logging, IAM, or KMS is restored. Specifically:

  • Layer 1 fails -> source stream paused or no PutRecord traffic.
  • Layer 2 fails -> Lambda errors or timeouts; check Lambda logs.
  • Layer 3 fails -> Glue schema mismatch or non-JSON input; check object size.
  • Layer 4 fails -> destination unreachable, IAM gap, or KMS denial.
  • Layer 5 fails -> CloudWatch logging disabled; enable before continuing.

Step 2: Diagnose delivery to S3 fails

Symptom: DeliveryToS3.Success drops below 100% or objects stop landing in the S3 bucket.

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].ExtendedS3DestinationDescription.[BucketARN,RoleARN,BufferingHints,EncryptionConfiguration]' --output table
aws s3api head-bucket --bucket <bucket-name>
aws s3api get-bucket-location --bucket <bucket-name>
aws cloudtrail lookup-events --lookup-attributes AttributeKey=EventName,AttributeValue=PutObject \
  --start-time $(date -u -v-1H +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --query 'Events[*].[EventTime,Username,ResourceName]' --output table | grep -i <bucket>
Cause Diagnostic signal Fix
Bucket deleted head-bucket returns 404 / NoSuchBucket Recreate the bucket; or update-destination to a new bucket
Bucket region mismatch get-bucket-location returns a region other than the Firehose region Move the bucket to the Firehose region; cross-region S3 is not supported
KMS key disabled / rotated kms describe-key shows KeyState: Disabled or PendingDeletion Re-enable or recreate the key; update EncryptionConfiguration.KMSEncryptionConfig
KMS key policy denies Firehose get-key-policy does not grant kms:GenerateDataKey to delivery.stream.amazonaws.com Add a statement allowing kms:GenerateDataKey, kms:Decrypt for ServicePrincipal: firehose.amazonaws.com
Bucket policy denies Firehose role Bucket policy Statement lacks s3:PutObject for the Firehose role ARN Add s3:PutObject, s3:AbortMultipartUpload, s3:ListBucketMultipartUploads to the bucket policy
Firehose role lacks s3:PutObject simulate-principal-policy returns Denied for s3:PutObject on the bucket Attach / extend the Firehose role policy
Object prefix has invalid characters Prefix contains //, leading /, or forbidden chars Fix the prefix in update-destination
Multipart upload never completed Object key fragments in _InProgress/; CompleteMultipartUpload denied Add s3:CompleteMultipartUpload; check S3 lifecycle for _ABORTED_

VERDICT: ROOT_CAUSE_FOUND when CloudTrail / IAM check identifies a specific cause; NEED_MORE_INFO when the bucket and IAM are correct but writes still fail (capture CloudTrail for the exact errorMessage).

Step 3: Diagnose data transformation Lambda fails

Symptom: DeliveryToS3.Success is healthy but transformed records are wrong, dropped to S3 backup, or Lambda errors spike.

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].<destination-block>.ProcessingConfiguration' --output table
aws lambda get-function --function-name <lambda-function-name> \
  --query 'Configuration.[Runtime,Timeout,MemorySize,Role]' --output table
aws lambda get-policy --function-name <lambda-function-name> --query 'Policy' --output text
aws logs filter-log-events --log-group-name /aws/lambda/<lambda-function-name> \
  --filter-pattern "ERROR Task timed out" --start-time $(date -u -v-1H +%s)000 --output table
Cause Diagnostic signal Fix
Lambda timeout CloudWatch Duration near Timeout; log shows "Task timed out after X seconds" Increase Lambda Timeout (max 900s); or reduce buffer size
Lambda exception Log shows stack trace; Errors metric > 0 Fix the handler code; common causes: JSON parse, missing field, ref-data fetch failure
Lambda response > 6 MB S3 backup receives full batches; log shows "response payload exceeds 6 MB" Reduce buffer size; or compress / trim records in the handler
Lambda resource policy lacks Firehose invoke get-policy lacks lambda:InvokeFunction for firehose.amazonaws.com Add lambda:InvokeFunction permission with principal firehose.amazonaws.com, source-arn = stream ARN
Lambda role lacks downstream access Logs show AccessDenied on DynamoDB / S3 ref-data Attach the required actions to the Lambda role
Lambda runtime deprecated Runtime: nodejs14.x or python3.7; deprecation warning Upgrade to a supported runtime (nodejs20.x, python3.12)
Lambda concurrency limit hit CloudWatch Throttles > 0 Raise reserved / account concurrency; or reduce buffer flush rate
Mismatched buffer vs Lambda duration Buffer flush every 60s but Lambda Timeout: 30s for a 50 MB batch Reduce buffer size or raise Lambda Timeout
Lambda returns malformed response Log shows "Invalid output format" Return { records: [{ recordId, result: 'Ok', data: base64 }], ... } exactly per the Firehose transform protocol

VERDICT: ROOT_CAUSE_FOUND when Lambda log identifies a specific cause; NEED_MORE_INFO when Lambda errors are intermittent (sample the handler code or ref-data source).

Step 4: Diagnose delivery lag (high DataFreshness)

Symptom: DeliveryToS3.DataFreshnessSec spikes; records land in S3 minutes or hours late.

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].<destination-block>.BufferingHints' --output table
aws cloudwatch get-metric-statistics --namespace AWS/Firehose \
  --metric-name DeliveryToS3.DataFreshnessSec \
  --dimensions Name=DeliveryStreamName,Value=<stream-name> \
  --start-time $(date -u -v-1H +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --period 60 --statistics Average,Maximum --output table
Cause Diagnostic signal Fix
Buffering hints too large BufferingHints.SizeInMBs: 128 and IntervalInSeconds: 900; low-traffic stream Reduce SizeInMBs to 5-10 or IntervalInSeconds to 60-300
Lambda processing slow Lambda Duration consistently > buffer flush interval Increase Lambda memory (proportional CPU); parallelize processing; or reduce buffer size
Firehose throttled on PutRecord Source-side ThrottledRecords > 0; WriteThroughputBytes flat Request a limit increase; or shard the stream
Destination backpressure (OpenSearch 429) OpenSearch 429 count > 0 in Firehose logs; circuit breaker engaged Scale OpenSearch cluster; raise Firehose IndexRotationPeriod
KMS throttling KMS ThrottledRequests > 0 Request KMS RPS limit increase; or use AWS managed key
S3 503 Slow Down S3 5xx rate elevated; CompleteMultipartUpload latency up Use a higher-cardinality prefix; reduce PUT rate per partition
Network path latency Cross-AZ or cross-region hops (VPN / PrivateLink) Co-locate Firehose and destination in the same region and AZ group

VERDICT: ROOT_CAUSE_FOUND when metric correlation identifies a specific cause; NEED_MORE_INFO when DataFreshness spikes are intermittent and uncorrelated with any single metric (instrument per-stage timing in the Lambda transform).

Step 5: Diagnose data format conversion fails (Parquet/ORC)

Symptom: objects land in S3 but Athena / engines return empty or 0-byte objects; DeliveryToS3.Success shows healthy.

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].ExtendedS3DestinationDescription.DataFormatConversionConfiguration' --output table
aws glue get-table --database-name <db> --name <table> \
  --query 'Table.[StorageDescriptor.Columns,Parameters]' --output table
aws s3api head-object --bucket <bucket> --key <prefix>/<latest-object> --query 'ContentLength' --output text
aws logs filter-log-events --log-group-name /aws/kinesisfirehose/<stream-name> \
  --filter-pattern "FormatConversion" --output table
Cause Diagnostic signal Fix
Input not valid JSON Firehose log: "Input record is not valid JSON"; records to S3 error backup Fix the producer to emit JSON; or change deserializer to OpenXJsonSerDe with tolerance
Glue schema mismatch get-table columns do not match JSON keys; Athena returns nulls Update the Glue table schema to match the data; or fix the producer
Hive SerDe mismatch (ORC vs Parquet) OutputFormat set to ORC but writer config is Parquet; or vice versa Align OutputFormatConfiguration.Format with the Glue table TableType and SerDe
Timestamp format wrong Athena returns nulls on timestamp columns; Firehose log: "Invalid timestamp" Add TimestampFormats to the SerDe (e.g., yyyy-MM-dd HH:mm:ss.SSSSSS)
Case sensitivity mismatch JSON keys snake_case but Glue columns CamelCase Set CaseInsensitive on the SerDe or rename Glue columns
Nested object not parsed Glue struct type but input is a string-encoded JSON Add Mapping or use a different SerDe; or pre-parse in Lambda transform
0-byte objects head-object ContentLength: 0 Conversion rejected the whole batch; check the S3 error backup and the Glue schema
Unsupported SerDe (CSV) InputFormatConfiguration.Deserializer is LazySimpleSerDe (CSV) but output is Parquet Use OpenXJsonSerDe for JSON-only inputs to Parquet/ORC conversion

VERDICT: ROOT_CAUSE_FOUND when Glue schema vs input diff identifies a specific cause; NEED_MORE_INFO when input is valid JSON and schema matches but conversion still fails (sample a record from the source and run it through the Glue crawler).

Step 6: Diagnose delivery to OpenSearch fails

Symptom: DeliveryToOpenSearch.Success drops below 100%; OpenSearch index missing recent documents.

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].AmazonopensearchserviceDestinationDescription.[DomainARN,IndexName,RoleARN,TypeName,S3BackupMode]' --output table
aws opensearch describe-domain --domain-name <domain-name> \
  --query 'DomainStatus.[Endpoints,ClusterConfig.InstanceType,ClusterConfig.InstanceCount,EncryptionAtRestOptions.Enabled]' --output table
aws cloudwatch get-metric-statistics --namespace AWS/Firehose \
  --metric-name DeliveryToOpenSearch.Success \
  --dimensions Name=DeliveryStreamName,Value=<stream-name> \
  --start-time $(date -u -v-1H +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) \
  --period 60 --statistics Average --output table
Cause Diagnostic signal Fix
Cluster unreachable describe-domain shows Endpoints: null or processing; Firehose log: Connection refused Wait for domain to finish processing; or check VPC endpoint reachability
Auth failure - IAM OpenSearch access policy does not allow the Firehose role Add the Firehose role to the domain access policy with es:ESHttpPost
Auth failure - basic Domain uses master-user auth; Firehose not configured with correct credentials Configure ClusterEndpoint + Username/Password (Secrets Manager)
Fine-grained access control (FGAC) Firehose role lacks the backend role mapping Map the Firehose role to the appropriate OpenSearch role via the security plugin
OpenSearch 429 (Too Many Requests) 429 count in Firehose logs; circuit breaker engaged Scale the cluster (more / larger instances); or shard the Firehose destination
Circuit breaker tripped Delivery resumes after sustained success; Success: 0 for the breaker window Same as 429; raise the breaker window via AWS Support if needed
Index name invalid Index name has uppercase or invalid char; 400 Bad Request Use lowercase, no special chars; use IndexRotationPeriod for time-based indices
Document mapping conflict Field type changes between records; OpenSearch rejects Map fields explicitly in the index template; or use dynamic templates
VPC OpenSearch without Firehose VPC config Firehose in a different VPC; private network unreachable Put Firehose in the same VPC as OpenSearch; or use a transit gateway
KMS key policy (encryption-at-rest) Key policy does not grant the Firehose role Add kms:GenerateDataKey, kms:Decrypt for the Firehose role
OpenSearch health yellow/red describe-domain-health shows Yellow/Red Resolve shard allocation; free disk space; or restart unhealthy nodes

VERDICT: ROOT_CAUSE_FOUND when access policy / OpenSearch health identifies a specific cause; NEED_MORE_INFO when auth is correct and the cluster is green but deliveries still fail (capture the exact HTTP response code from Firehose logs).

Step 7: Diagnose delivery to Redshift fails

Symptom: DeliveryToRedshift.Success drops; Redshift tables missing recent data.

aws firehose describe-delivery-stream --delivery-stream-name <stream-name> \
  --query 'DeliveryStreamDescription.Destinations[0].RedshiftDestinationDescription.[ClusterJDBCURL,CopyCommand,RoleARN,Username,S3Configuration]' --output table
aws redshift describe-clusters --cluster-identifier <cluster-id> \
  --query 'Clusters[0].[ClusterStatus,ClusterAvailabilityStatus,NodeType,NumberOfNodes]' --output table
aws logs filter-log-events --log-group-name /aws/kinesisfirehose/<stream-name> \
  --filter-pattern "COPY" --output table

Connect to Redshift and check the load errors:

SELECT query, filename, line_number, colname, type, err_reason
FROM stl_load_errors
WHERE start_time > dateadd(hour, -1, getdate())
ORDER BY start_time DESC LIMIT 20;
Cause Diagnostic signal Fix
Redshift cluster paused / unavailable describe-clusters shows paused, available with no active connections, or resizing Resume the cluster; wait for resize; or use a Multi-AZ cluster
JDBC URL unreachable Firehose log: Connection refused Verify the security group allows the Firehose subnet to TCP/5439; or use Firehose-in-VPC
Credentials invalid Firehose log: Authentication failed Update Username + Password (Secrets Manager); rotate
COPY column mismatch stl_load_errors shows Extra column(s) / Missing column(s) Align the CopyCommand.DataTableColumns with the table schema
Encoding / format invalid stl_load_errors shows Invalid digit, Value '.', ... Fix the producer format; or set COPY ... ACCEPTANYDATE / TRIMBLANKS / NULL AS
Staging bucket IAM gap Firehose delivers to staging; COPY fails with S3ServiceException: Access Denied Grant the Redshift cluster role (not Firehose role) s3:GetObject on the staging bucket
Staging bucket deleted head-bucket on staging bucket returns 404 Recreate staging bucket; or update-destination to a new staging bucket
Staging bucket region mismatch Staging bucket in a different region than Redshift Move staging bucket to the Redshift region
COPY timeout stl_load_errors shows large file; COPY duration > Firehose retry window Split files (smaller Firehose buffer); or use COPY ... MAXERROR 100 with monitoring
Date / timestamp format stl_load_errors shows Invalid timestamp format Set COPY ... FORMAT AS CSV and timeformat AS 'YYYY-MM-DD HH:MI:SS'
KMS key for staging bucket Redshift cluster role lacks kms:Decrypt on the staging bucket key Add the Redshift cluster role to the staging bucket KMS key policy

VERDICT: ROOT_CAUSE_FOUND when stl_load_errors identifies a specific cause; NEED_MORE_INFO when the COPY appears to succeed but rows are missing (check the Redshift workload manager and transaction commits).

Step 8: Diagnose latest destinations (Snowflake / HTTP / Splunk)

Moved verbatim → references/firehose-delivery-diagnostics.md § "Step 8: Diagnose latest destinations (Snowflake / HTTP / Splunk)". Load when: diagnosing Snowflake, HTTP endpoint, or Splunk destinations — per-destination cause/signal/fix tables.

Output format

The output block template above is the authoritative structure. Violating any rule is a misdiagnosis. Three worked examples follow.

Worked example - ROOT_CAUSE_FOUND, DeliveryToS3Fails (KMS gap)

DIAGNOSIS: prod-firehose-s3
DELIVERY_STREAM: prod-events-delivery
DESTINATION: s3 (extended)
SYMPTOM: DeliveryToS3Fails
ROOT_CAUSE: KMS key policy on arn:aws:kms:us-east-1:111111111111:key/abc123
            does not grant the Firehose service principal
            kms:GenerateDataKey. The key policy allows only the
            customer account root.
EVIDENCE:
  - CloudTrail PutObject events for the Firehose role show errorMessage: "AccessDenied: kms:GenerateDataKey on arn:aws:kms:us-east-1:111111111111:key/abc123"
  - aws kms get-key-policy: Statement Principal = {"AWS": "arn:aws:iam::111111111111:root"} only
LAYER_CHECK:
  - Source: PASS - IncomingBytes > 0; stream type DirectPut
  - Transform: N/A - no Lambda processing configured
  - Convert: N/A - no format conversion
  - Deliver: FAIL - KMS key policy denies Firehose service principal
  - Observability: PASS - CloudWatch logging enabled
FIX:
  - Add the Firehose service principal to the KMS key policy:
    aws kms put-key-policy --key-id arn:aws:kms:us-east-1:111111111111:key/abc123 --policy-name default --policy '{"Id":"firehose-key-policy","Version":"2012-10-17","Statement":[{"Sid":"Enable IAM permissions","Effect":"Allow","Principal":{"AWS":"arn:aws:iam::111111111111:root"},"Action":"kms:*","Resource":"*"},{"Sid":"Allow Firehose","Effect":"Allow","Principal":{"Service":"firehose.amazonaws.com"},"Action":["kms:GenerateDataKey","kms:Decrypt"],"Resource":"*"}]}'
  - No Firehose-side change; the key policy is the only gap.
VERIFICATION:
  - aws cloudwatch get-metric-statistics --namespace AWS/Firehose --metric-name DeliveryToS3.Success --dimensions Name=DeliveryStreamName,Value=prod-events-delivery --start-time $(date -u -v-15M +%Y-%m-%dT%H:%M:%S) --end-time $(date -u +%Y-%m-%dT%H:%M:%S) --period 60 --statistics Average --output table
  - Expect: Average >= 1.0 within 5-10 minutes of the key policy update.
VERDICT: ROOT_CAUSE_FOUND
NEXT_STEP: None
ESCALATION_PATH: None

Worked example - NEED_MORE_INFO, DeliveryLag (intermittent)

Moved verbatim → references/worked-examples.md § "Worked example - NEED_MORE_INFO, DeliveryLag (intermittent)". Load when: emitting a NEED_MORE_INFO verdict — intermittent DeliveryLag example with per-stage timing next steps.

Worked example - ESCALATE, OpenSearchFails (cluster red)

Moved verbatim → references/worked-examples.md § "Worked example - ESCALATE, OpenSearchFails (cluster red)". Load when: emitting an ESCALATE verdict — OpenSearch cluster-red example with out-of-band remediation.

Anti-Patterns - NEVER do these things

  • NEVER diagnose a Firehose failure without first running the 5-layer health check. Most "delivery fails" tickets are coverage gaps in the transform Lambda, KMS key policy, or destination reachability.
  • NEVER assume the delivery-stream status ACTIVE means records are being delivered. ACTIVE only means the stream config is accepted; per-record delivery failures are surfaced via CloudWatch metrics and S3 backup, not status.
  • NEVER confuse a Lambda transform timeout with a Firehose bug. Firehose invokes the transform with the configured buffer; a Lambda slower than the buffer cadence produces backpressure, not a Firehose failure.
  • NEVER assume Parquet/ORC conversion is working because objects land in S3. Conversion can produce 0-byte objects if the input JSON is malformed or the Glue table schema does not match the data. Always verify object size, not just object count.
  • NEVER emit VERDICT: NEED_MORE_INFO without a NEXT_STEP naming a specific diagnostic command. Generic phrases like "investigate further" are not acceptable.

Pre-flight safety checks

Moved verbatim → references/diagnostic-commands.md § "Pre-flight safety checks". Load when: before any state-changing operation — confirmation gate, update-destination blast radius, KMS policy backup.

Appendix A - Symptom-to-cause map (quick reference)

Moved verbatim → references/firehose-delivery-diagnostics.md § "Appendix A - Symptom-to-cause map (quick reference)". Load when: mapping a symptom to its most common root cause and the command that verifies it.

Recent AWS features (2024-2026)

Moved verbatim → references/advanced-patterns.md § "Recent AWS features (2024-2026)". Load when: checking 2024-2026 feature availability — Snowflake GA, dynamic partitioning, Firehose-in-VPC, multi-AZ delivery.

AWS documentation

References (load on demand)

04 同仓库更多 Skills

jhkchan
jhkchan/aws-agent-skills

xray-tracing-deployer

Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL / method / service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry / ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS / EKS / Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.

★ 4
jhkchan
jhkchan/aws-agent-skills

wellarchitected-workload-auditor

Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.

★ 4
jhkchan
jhkchan/aws-agent-skills

wellarchitected-review-operator

Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer / get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.

★ 4
jhkchan
jhkchan/aws-agent-skills

wafv2-web-acl-deployer

Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB/API Gateway/CloudFront, or configuring CAPTCHA/Challenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.

★ 4
jhkchan
jhkchan/aws-agent-skills

wafv2-web-acl-auditor

Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow/bypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.

★ 4
jhkchan
jhkchan/aws-agent-skills

waf-rule-deployer

Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.

★ 4