# 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.

- Skill: `jhkchan/kinesis-firehose-troubleshooter` (Agent Skill, multi-file: 20 files)
- Install (CLI): `npx get-skill add jhkchan/kinesis-firehose-troubleshooter`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jhkchan/kinesis-firehose-troubleshooter/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Data & Analytics
- License: Apache-2.0
- Author: jhkchan (https://skillmd.com/u/jhkchan)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/jhkchan/kinesis-firehose-troubleshooter

---


# 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.

```text
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](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](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):**

```bash
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:

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

**Layer 2 - Transform (Lambda is not erroring):**

```bash
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):**

```bash
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):**

```bash
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:

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

**Layer 5 - Observability (logging is enabled):**

```bash
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.

```bash
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.

```bash
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.

```bash
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.

```bash
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.

```bash
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.

```bash
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:

```sql
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](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)

```text
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](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](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](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](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](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

- **Amazon Kinesis Data Firehose Developer Guide** - https://docs.aws.amazon.com/firehose/latest/dev/what-is-this-service.html
- **Firehose delivery stream creation** - https://docs.aws.amazon.com/firehose/latest/dev/basic-create.html
- **Firehose data transformation** - https://docs.aws.amazon.com/firehose/latest/dev/data-transformation.html
- **Firehose data format conversion** - https://docs.aws.amazon.com/firehose/latest/dev/data-conversion.html
- **Firehose destinations (OpenSearch / Redshift / Snowflake / Splunk / HTTP)** - https://docs.aws.amazon.com/firehose/latest/dev/create-destination.html
- **Firehose HTTP endpoint request/response** - https://docs.aws.amazon.com/firehose/latest/dev/httpdeliveryrequestresponse.html
- **Monitoring Firehose with CloudWatch** - https://docs.aws.amazon.com/firehose/latest/dev/monitoring-with-cloudwatch-metrics.html
- **Firehose troubleshooting** - https://docs.aws.amazon.com/firehose/latest/dev/troubleshooting.html
- **Firehose IAM roles** - https://docs.aws.amazon.com/firehose/latest/dev/controlling-access.html
- **API Reference** - https://docs.aws.amazon.com/firehose/latest/APIReference/
- **CLI Reference** - https://docs.aws.amazon.com/cli/latest/reference/firehose/

## References (load on demand)

- [references/worked-examples.md](references/worked-examples.md) — secondary worked examples: NEED_MORE_INFO (intermittent DeliveryLag) and ESCALATE (OpenSearch cluster red) full DIAGNOSIS blocks
- [references/diagnostic-commands.md](references/diagnostic-commands.md) — pre-flight data requirements (inputs + malformed-input block) and pre-flight safety checks
- [references/advanced-patterns.md](references/advanced-patterns.md) — Step 0 non-obvious Firehose behaviors and recent AWS features 2024-2026
- [references/firehose-delivery-diagnostics.md](references/firehose-delivery-diagnostics.md) — diagnostic command quick lookup, per-destination CloudWatch metrics, Step 8 latest-destination cause tables, Appendix A symptom-to-cause map (moved verbatim; existing deep reference)

