Skip to content

Architecture Decisions

Key technical decisions made during the design of this workshop architecture.

Decision Choice Rationale
AppSync private VPC resources Lambda resolver (proxy) AppSync HTTP data sources support public endpoints only
AppSync real-time backend publishing HTTP POST to /event No WebSocket required for publishers; subscribers use WebSocket
Cloud live data (RisingWave) ALB → Next.js SSE + RisingWave SUBSCRIBE API Gateway max timeout is 300 s — incompatible with long-lived SSE; ALB supports up to 4,000 s idle timeout
Cloud live data (TimescaleDB) ALB → Next.js SSE + PostgreSQL LISTEN/NOTIFY TimescaleDB has no SUBSCRIBE primitive; insert trigger fires pg_notify, Next.js listens and re-queries a 60 s window
Edge live data (RisingWave) Next.js SSE + RisingWave SUBSCRIBE No GraphQL server needed; node-postgres connects directly via PG wire
Edge K8s distribution K3s (workshop) / RKE2 (production) K3s bootstraps in minutes; RKE2 is FIPS 140-2 validated for regulated environments
Industrial site HMI React Flow MIT license, 36.9k GitHub stars, custom SVG nodes, built-in mouseover interaction
IoT Jobs fleet deployment timer 45-min in-progress timer K3s install ≈ 10–20 min; 45 min gives safe margin within 7-day max
MSK type for IoT Rules Kafka action Provisioned MSK only MSK Serverless does not support SASL/SCRAM; IoT Kafka action requires Provisioned
S3 table format Apache Iceberg via Amazon Data Firehose An IoT Rule Firehose action delivers telemetry straight to a DirectPut Firehose stream that writes to Iceberg (Glue Data Catalog) natively — no custom connector or Spark/Glue cluster required; fully-managed, config-only delivery
Archive-tier delivery mechanism Amazon Data Firehose (DirectPut, fed by an IoT Rule), chosen over Apache Hudi (original design) and a custom Amazon Managed Service for Apache Flink sink (interim design) Hudi's MoR/CoW model needed a hand-maintained connector; the Flink app that replaced it existed only to bundle iceberg-flink-runtime + a Hadoop S3A stack for packaging, with no meaningful custom stream logic. A direct IoT Rule → Firehose → Iceberg path removes both the connector and the fat-jar maintenance burden entirely, and drops the MSK hop from the archive tier — see amplify/custom/platform-stack.ts
Fleet Provisioning approach By claim Claim cert in Secrets Manager, retrieved by EC2 instance profile; fully automated CDK deployment with no human commissioning step
Slot topology One shared WorkshopPlatformStack with per-slot nested stacks (Auth + Data + Participant), driven by a WORKSHOP_SLOTS list — chosen over the previous model of a separate managed auth/data backend + a top-level ParticipantStack per slot A single cdk deploy target now brings up the platform and every slot, so the deploy is one idempotent operation that a cloud orchestrator can run fire-and-forget (see below). The auth/data resources are plain CDK constructs (amplify/custom/auth-stack.ts, data-stack.ts, schema.graphql), each owned by CloudFormation like every other stack. Accepted trade-off: a slot no longer has its own top-level stack, so there is no independent per-slot cdk destroy. Removing one slot is now a platform update — drop it from the persisted active-slot set and re-deploy (scripts/delete-slot.sh, scripts/slot-list.sh); CFN then deletes that slot's three nested stacks while every other slot and all shared infra stay put. The active-slot list is persisted in SSM (/workshop/platform/active-slots) precisely because WORKSHOP_SLOTS is authoritative — a deploy that omitted a slot would tear it down, so add/remove must union with the persisted set.
Async, fire-and-forget deploy Cloud-side CodeBuild orchestrator (workshop-deploy-orchestrator) runs the single deploy + per-slot post-deploy tail; the GitHub deploy.yml workflow only triggers it and exits A full deploy is 20-40+ min. Blocking a GitHub Actions runner (or a laptop) for that long is wasteful and fragile. aws codebuild start-build returns a build id immediately as a pollable handle (scripts/trigger-deploy.sh → scripts/poll-deploy.sh), so the trigger is near-instant and the deploy runs in the cloud. Idempotent + concurrentBuildLimit=1 so re-runs and concurrent dispatches never race the shared CloudFormation stack. Trade-off: the orchestrator's CodeBuild role is admin-equivalent because the deploy creates essentially the whole account footprint (VPC/EKS/MSK/IAM/IoT/Firehose/S3) — the same blast radius as a facilitator's own credentials; tightening to least-privilege is follow-up work.
RisingWave-compute node group scope (#211) One shared rw-compute managed node group (r6i.xlarge) for the whole cluster, not one per slot The freshness/clock-skew bug (#206) was CPU starvation from sharing a burstable t3.medium with unrelated pods — a class of instance problem, not a cross-slot isolation problem. The taint (dedicated=risingwave-compute:NoSchedule) already keeps every non-RW-compute pod off these nodes regardless of how many slots' compute pods land there, so per-slot node groups would multiply the (non-trivial, memory-optimized) r6i.xlarge cost by the slot count for no additional freshness benefit. Accepted trade-off: the pool scales via scalingConfig (min:1/desired:1/max:8, matching workshop-nodes), but there is no cluster-autoscaler wired up, so scaling out to more concurrent slots than fit on the current node count means manually bumping desiredSize — same limitation workshop-nodes already has, not new to this change.
Managed hot tier: Amazon Timestream for InfluxDB (#233) Add a managed time-series hot store next to the self-managed TimescaleDB tier, as one shared instance fed by Telegraf off the same MSK topics Teaches the managed-vs-self-managed hot-tier decision hands-on: same telemetry, same freshness question, opposite operating model — the managed store removes the checkpoint/affinity/node-sizing operational surface TimescaleDB and RisingWave hit, trading away a push primitive (no LISTEN/SUBSCRIBE, so Block 6 polls it) and some control. One db.influx.medium instance keeps cost bounded regardless of slot count. Telegraf, not a second Redpanda Connect pipeline: it's InfluxData's first-party agent with native influxdb_v2 line-protocol output and a kafka_consumer input, so the sink is config-only. In-cluster token minting: the instance is VPC-private and exposes only admin user/pass (never a token), so a Helm post-install Job signs in, creates the bucket, mints a scoped token, and writes the influxdb-credentials Secret — the deploy script can't reach the private endpoint to do it. Originally one bucket per slot (workshop-<deploymentId>); collapsed into the one shared bucket by #253 below. See amplify/custom/platform-stack.ts and helm/cloud-analytics.
Cloud-analytics topology: one shared release, not one per slot (#253) Collapse the per-slot cloud-analytics Helm release (RisingWave + TimescaleDB + redpanda-connect + telegraf + dashboard) into one shared release for the whole workshop, filtered by a deployment_id column/tag carried through every store instead of a per-slot namespace/topic filter Each slot's release was a full analytics stack on a fixed-size general nodegroup — by ~4 concurrent slots the cluster was 85–95% full and further slot installs failed outright (timed out waiting for the condition) or left pods Pending, a hard ceiling on workshop size. The upstream MSK data already carries slot identity (raw.telemetry stamps deployment_id; sensors.raw.* derives it from the ^ws-slot[0-9]+ prefix of site_id), so this is a filter/grouping change, not a new data pipeline: RisingWave's MVs, TimescaleDB's hypertable, the InfluxDB bucket, and the dashboard's queries all promote deployment_id/did instead of relying on release-per-slot isolation. Accepted trade-off: reduced per-participant isolation (one participant's queries share compute/storage with every other slot) for the capacity headroom needed to run a full workshop. Session-04 hands-on objects a participant creates (e.g. a TimescaleDB continuous aggregate) now need a slot-prefixed name to avoid colliding with every other participant's object in the same shared database.
Telemetry-agent update mechanism (#149–#151) Custom IoT Job carrying a published Software Package version via --destination-package-versions — not the console's "Deploy a single Software Package version" (pure SPC) flow SPC sits on top of IoT Jobs, it doesn't replace them: associating a package version does not install anything on the device and the "Deploy a single Software Package version" wizard still creates a Job under the hood. The workshop's payload is an imperative reconfiguration script (job-scripts/telemetry-v*.sh — rewrites publish-telemetry.sh, restarts workshop-telemetry), which the aws-iot-device-client runs via its generic run-script.sh Jobs handler — exactly the custom-job sweet spot. Going pure-SPC would require giving each catalog version a deployable artifact (versions are metadata-only today) and baking a device-side installer onto the instances (the device client has no native package-install feature; it only implements Jobs + Secure Tunneling). The custom-job-plus-destinationPackageVersions design already gets the one thing SPC adds — IoT auto-writing the reserved $package shadow on SUCCEEDED (via platform versionUpdateByJobsConfig) plus fleet-indexing on version — without that device-installer investment. Accepted trade-off: the handler must still write the app-level device-config.reported.config_version shadow itself, since package deployment only manages $package (the block-4 drift exercise depends on that write). Revisit if the payload ever becomes a real versioned binary/firmware artifact.

References