{"id":22816504,"url":"https://github.com/msysh/aws-sample-amplify-gen2-mutating-from-lambda","last_synced_at":"2025-03-30T22:42:09.262Z","repository":{"id":243781580,"uuid":"813419921","full_name":"msysh/aws-sample-amplify-gen2-mutating-from-lambda","owner":"msysh","description":"This project is an Amplify Gen2 demo app that Lambda mutates to AppSync and delivers events to subscribed React App in near real time.","archived":false,"fork":false,"pushed_at":"2024-06-11T11:10:25.000Z","size":155,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-06T03:51:18.787Z","etag":null,"topics":["amplify-gen2","appsync","lambda","react"],"latest_commit_sha":null,"homepage":"https://blog.msysh.me/posts/2024/06/mutate-to-appsync-from-lambda-and-deliver-realtime-events.html","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msysh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-11T03:52:30.000Z","updated_at":"2025-01-29T04:49:23.000Z","dependencies_parsed_at":"2024-06-11T05:40:20.292Z","dependency_job_id":"38dca82a-373d-4c26-9faf-4c904b4d7588","html_url":"https://github.com/msysh/aws-sample-amplify-gen2-mutating-from-lambda","commit_stats":null,"previous_names":["msysh/aws-sample-amplify-gen2-mutating-from-lambda"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msysh%2Faws-sample-amplify-gen2-mutating-from-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msysh%2Faws-sample-amplify-gen2-mutating-from-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msysh%2Faws-sample-amplify-gen2-mutating-from-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msysh%2Faws-sample-amplify-gen2-mutating-from-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msysh","download_url":"https://codeload.github.com/msysh/aws-sample-amplify-gen2-mutating-from-lambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390858,"owners_count":20769476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amplify-gen2","appsync","lambda","react"],"created_at":"2024-12-12T14:07:45.176Z","updated_at":"2025-03-30T22:42:09.238Z","avatar_url":"https://github.com/msysh.png","language":"TypeScript","readme":"# Demo of mutating from Lambda to AppSync and subscribing from React App\n\n[日本語の情報(for Japanese)](https://blog.msysh.me/posts/2024/06/mutate-to-appsync-from-lambda-and-deliver-realtime-events.html)\n\nThis project is an Amplify Gen2 demo app that Lambda mutates to AppSync and delivers events to subscribed React App in near real time.\nLambda is triggered to update items in DynamoDB via DynamoDB Streams.\n\n## Architecture\n\n![Architecture](./doc/architecture.svg)\n\n## Getting Started\n\n### 1. Clone this project\n\n```shell\ngit clone https://github.com/msysh/aws-sample-amplify-gen2-mutating-from-lambda.git\n```\n\n### 2. Install packages\n\n```shell\npnpm install   # or npm install\n```\n\n### 3. Launch sandbox\n\n```shell\npnpm exec ampx sandbox   # or npx ampx sandbox\n```\n\n### 4. Update AppSync schema via AWS Management Console\n\nAt the moment, it is not possible to use IAM authentication with custom mutations, so we will change the schema from the AWS Management Console.\n\n1. After logging in to the AWS Management Console, select the API from AppSync, and then select the \"Schema\" from the left menu.\n2. In the \"Mutation\" section, find `updateConnectionStatus` and insert `@aws_iam`, and then \"Save Schema\"\n![Change schema via Management Console](./doc/change-schema-via-management-console.png)\n\nThis issue is also being discussed on GitHub.\n* [Unable to use “iam” authorization for custom mutations in v6.2 #13339](https://github.com/aws-amplify/amplify-js/issues/13339)\n\n### 5. Launch React app\n\n```shell\npnpm run dev\n```\n\nLet's access `http://localhost:5173` and create a your account.\n\nThat account will be created in the Cognito UserPool you just deployed in your AWS account.\n\n### 6. Create a new item in DynamoDB\n\nPressing the “New Device” button will create a new item in DynamoDB.\n\n![Add a new item to DynamoDB](./doc/new-device-button.png)\n\n### 7. Update DynamoDB items directly\n\nWhen you explore for the DynamoDB table in the AWS Management Console, the device is created.\nEdit directly the `isConnect` attribute of the item from `false` to `true`.\n\n### 8. Check the display with a React App\n\nPlease check that the `isConnect` column for the item displayed in the React app is updated in near real time.\n\n## Cleanup\n\nSimply stopping the sandbox will not delete the AWS resources. Use the following command to delete the sandbox.\n\n```shell\npnpm exec ampx sandbox delete   # or npx ampx sandbox delete\n```\n\n## License\n\nMIT","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsysh%2Faws-sample-amplify-gen2-mutating-from-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsysh%2Faws-sample-amplify-gen2-mutating-from-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsysh%2Faws-sample-amplify-gen2-mutating-from-lambda/lists"}