Skip to content

add sample: AWS Replicator, Proxy & Cloud Pods demo#13

Merged
whummer merged 3 commits into
mainfrom
feature/aws-replicator-proxy-sample
Jun 15, 2026
Merged

add sample: AWS Replicator, Proxy & Cloud Pods demo#13
whummer merged 3 commits into
mainfrom
feature/aws-replicator-proxy-sample

Conversation

@whummer

@whummer whummer commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds samples/aws-replicator-proxy/ — a minimal product catalog (S3 + API Gateway v2 + Lambda + DynamoDB) demonstrating three LocalStack features in one place
  • Scenario 1 — Replicator: deploy to real AWS, then clone the DynamoDB table and Lambda into LocalStack via direct boto3 (replicator extension doesn't support Lambda yet, and requires AWS creds inside the container for DynamoDB)
  • Scenario 2 — Proxy: deploy everything to LocalStack, enable the DynamoDB proxy so local Lambda calls transparently read/write real AWS DynamoDB
  • Scenario 3 — Cloud Pods: snapshot full LocalStack state (DynamoDB, Lambda, S3, API GW) into a versioned pod; restore on any machine with make pod-load

Frontend supports listing, adding, editing (PUT), and deleting (DELETE) products. CORS is handled in the Lambda so it works identically on AWS and LocalStack without relying on API Gateway CORS config.

Key technical notes

  • local_client() in replicate.py always uses aws_access_key_id="test" so all LocalStack resources land in the 000000000000 account namespace. Lambda env vars are also pinned to fake creds for the same reason — LocalStack injects the host's real AWS credentials into Lambda containers, which would otherwise put SDK calls in a different account namespace and make local DynamoDB tables invisible.
  • json.loads(..., parse_float=Decimal) in the Lambda handler avoids the boto3 float/Decimal mismatch for POST/PUT bodies.
  • GATEWAY_SERVER=hypercorn is required for the proxy feature.

Test plan

  • make localstack-start — LocalStack starts cleanly
  • make help — all three scenario sections appear
  • Scenario 1: make deploy-aws && make seed-aws && make replicate && make test-local
  • Scenario 2: make deploy-local && make seed-local && make setup-aws-dynamo && make enable-proxy && make test-local
  • Scenario 3: make pod-save && make localstack-stop && make localstack-start && make pod-load && make test-local
  • Frontend: add, edit, delete products all work; CORS preflight returns correct headers

🤖 Generated with Claude Code

whummer and others added 2 commits June 15, 2026 00:22
Adds a new sample app at samples/aws-replicator-proxy/ — a minimal
product catalog (S3 + API Gateway v2 + Lambda + DynamoDB) that demonstrates
three LocalStack features side by side:

- Scenario 1 (Replicator): deploy to real AWS, then replicate the DynamoDB
  table and Lambda into LocalStack via direct boto3 calls (bypassing the
  replicator extension, which doesn't support Lambda yet).

- Scenario 2 (Proxy): deploy everything to LocalStack, then enable the
  DynamoDB proxy so local Lambda calls transparently hit real AWS DynamoDB.

- Scenario 3 (Cloud Pods): snapshot the full LocalStack state (DynamoDB,
  Lambda, S3, API GW) into a versioned pod and restore it on any machine.

The frontend supports listing, adding, editing, and deleting products.
CORS is handled in the Lambda so it works identically on AWS and LocalStack.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@whummer whummer changed the base branch from master to main June 15, 2026 04:36
…est items

- frontend: use JSON.stringify instead of esc() for deleteProduct args so
  names with single quotes don't break the onclick attribute
- replicate.py: guard against IndexError when existing API has no integrations
- test.py: DELETE the smoke test item after verifying it, so repeated runs
  don't accumulate stale items in the table

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@whummer whummer marked this pull request as ready for review June 15, 2026 04:45
@whummer whummer merged commit b1428aa into main Jun 15, 2026
0 of 2 checks passed
@whummer whummer deleted the feature/aws-replicator-proxy-sample branch June 15, 2026 04:46
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