This project is an Amplify Gen2 demo app that Lambda mutates to AppSync and delivers events to subscribed React App in near real time. Lambda is triggered to update items in DynamoDB via DynamoDB Streams.
git clone https://github.com/msysh/aws-sample-amplify-gen2-mutating-from-lambda.gitpnpm install # or npm installpnpm exec ampx sandbox # or npx ampx sandboxAt the moment, it is not possible to use IAM authentication with custom mutations, so we will change the schema from the AWS Management Console.
- After logging in to the AWS Management Console, select the API from AppSync, and then select the "Schema" from the left menu.
- In the "Mutation" section, find
updateConnectionStatusand insert@aws_iam, and then "Save Schema"
This issue is also being discussed on GitHub.
pnpm run devLet's access http://localhost:5173 and create a your account.
That account will be created in the Cognito UserPool you just deployed in your AWS account.
Pressing the “New Device” button will create a new item in DynamoDB.
When you explore for the DynamoDB table in the AWS Management Console, the device is created.
Edit directly the isConnect attribute of the item from false to true.
Please check that the isConnect column for the item displayed in the React app is updated in near real time.
Simply stopping the sandbox will not delete the AWS resources. Use the following command to delete the sandbox.
pnpm exec ampx sandbox delete # or npx ampx sandbox deleteMIT
