aws-lambda - Should I create database update function outside of amplify?
问题描述
I have an app that gets data from dynamodb with a lambda function. And I want to update the database periodically with another lambda function that makes a request to an external api to get data.
I created all functions with amplify-cli but I think it wasn't a good idea. And with this way I also stuck on making external request authentication because I can't upload client secret json file with the function.
Should I create the updater function outside of amplify-cli? If so, how should I do it?
Thanks
解决方案
Amplify is most useful when creating external resources that a front-end application will call over the public Internet.
If you need to periodically execute some logic, you probably don't need to make it publicly available. I suggest to create a scheduled execution Lambda function, using a CloudWatch event as a periodic trigger.
Here's an example of how to do that.
The Lambda function you write can call DynamoDB directly to query/update values.
推荐阅读
- kdb - 在一天结束时复制错误
- c++ - 错误:可变大小的对象可能未初始化 编译时有时会出现此问题 如何解决?
- python-3.x - 与 pandas 数据框 groupby 相关的五个问题
- blazor - 在单独的页面/组件上编辑 DataGrid
- go - 使用 http.FileServer 按需生成文件
- c# - 尝试解压缩文件夹时访问被拒绝
- symfony - 无法将字符串分配给存储库中的属性 ID
- python - 基于多索引比较选择行
- flutter - Flutter full pdf viewer 未在 iOS 上显示 pdf(适用于 Android 设备)
- unit-testing - 使用互斥锁和解锁时 Go 测试挂起