Skip to content

Real-AWS deploy composition for recently-interacted-topk - #53

Open
pequalsnp wants to merge 1 commit into
mainfrom
terraform-multisource
Open

Real-AWS deploy composition for recently-interacted-topk#53
pequalsnp wants to merge 1 commit into
mainfrom
terraform-multisource

Conversation

@pequalsnp

Copy link
Copy Markdown
Contributor

Summary

Lands the prep work needed to start the v1 real-AWS soak documented in STABILITY.md. One terraform apply stands up the multi-source TopK example end to end and exercises the experimental code paths that need operational evidence before promotion (Lambda Kinesis runtime, processor core, Kafka per-partition concurrency).

What this adds

pipeline-counter additions:

  • New dedup_enabled flag — provisions <name>_dedup (pk:S hash, native TTL on ttl), grants worker + bootstrap RW, injects DDB_DEDUP_TABLE env var into all three tasks. Exposed as dedup_table_arn / dedup_table_name outputs so sibling modules share the same table.

New pipeline-lambda-kinesis module:

  • Kinesis data stream (or BYO via kinesis_stream_arn).
  • Lambda function — provided.al2, arm64 by default, deployment-zip driven, content-hashed via filebase64sha256.
  • Event-source mapping with BatchItemFailures + bisect_batch_on_function_error; tunable batch_size / parallelization_factor / starting_position (supports AT_TIMESTAMP for bootstrap-to-live handoff).
  • IAM: AWSLambdaBasicExecutionRole + Kinesis consumer perms + DDB state RW + optional dedup RW + optional SQS/SNS on-failure destination.
  • CloudWatch log group with caller-controlled retention.

examples/recently-interacted-topk/terraform/:

  • Composes both modules.
  • CloudWatch alarms: Lambda Errors / IteratorAge / Throttles, DDB WriteThrottles on state + dedup, Kinesis WriteProvisionedThroughputExceeded. All route to alarm_sns_topic_arn when set.
  • terraform.tfvars.example + runbook (prereqs → image build → Lambda zip → apply → smoke test → observability → teardown). Includes rough cost notes (~$100/mo for a low-volume soak).

Test plan

  • terraform validate on both modules and the example composition.
  • terraform fmt -check -recursive deploy/terraform examples/recently-interacted-topk/terraform.
  • Manual: at least one apply against a sandbox AWS account before merging — this is infra code; validate is necessary but not sufficient.
  • Manual: smoke test from the runbook (Kafka + Kinesis events both land in the same DDB row; GetWindow returns the merged Top-N).

Follow-ups (separate PRs)

  • Begin the real-AWS soak using this composition. STABILITY.md's "exercised against real (non-local) AWS for at least one full quarter" clock starts on apply.
  • Promote pkg/exec/processor + pkg/exec/lambda/{kinesis,dynamodbstreams,sqs} + pkg/source/kafka to mostly stable once the soak is uneventful.

🤖 Generated with Claude Code

Lands the prep work needed to start the v1 real-AWS soak documented in
STABILITY.md. One terraform apply stands up the multi-source TopK
example end to end and exercises the load-bearing experimental code
paths (Lambda Kinesis runtime, processor core, Kafka per-partition
concurrency).

pipeline-counter additions:

- New dedup_enabled flag: provisions <name>_dedup (pk:S, native TTL on
  ttl), grants worker + bootstrap RW on it, injects DDB_DEDUP_TABLE
  into all three task envs. Exposed as dedup_table_arn /
  dedup_table_name outputs so sibling modules share the same table.

New pipeline-lambda-kinesis module:

- Kinesis data stream (or BYO via kinesis_stream_arn).
- Lambda function: provided.al2, arm64 by default, deployment-zip
  driven, content-hashed via filebase64sha256 so re-builds are
  cache-friendly.
- Event-source mapping: BatchItemFailures, bisect_batch_on_function_error,
  caller-tunable batch_size / parallelization_factor / starting_position
  (LATEST / TRIM_HORIZON / AT_TIMESTAMP for bootstrap-to-live handoff).
- IAM: AWSLambdaBasicExecutionRole + Kinesis consumer perms + DDB
  state RW + optional dedup RW + optional SQS/SNS on-failure dest.
- CloudWatch log group with caller-controlled retention.

examples/recently-interacted-topk/terraform/:

- Composes the two modules; one terraform apply stands up the whole
  topology.
- CloudWatch alarms: Lambda Errors / IteratorAge / Throttles, DDB
  WriteThrottles on state + dedup, Kinesis WriteThrottles. All route
  to alarm_sns_topic_arn when set.
- terraform.tfvars.example with placeholder values.
- README.md: prerequisites → image build → Lambda zip → apply →
  smoke test → observability → teardown. Includes order-of-magnitude
  cost notes for a low-volume soak.

Both modules validate clean (terraform validate) and pass
terraform fmt -recursive.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant