英文:
How to add FilterCriteria to a DynamoDB Stream CloudFormation template created by AWS Amplify?
问题
你可以尝试使用 AWS Amplify CLI 来为 DynamoDB 表流创建 Lambda 触发器。亚马逊提供的文档按预期工作。但是,我想要向流配置添加筛选条件。Amplify 生成了一个 CloudFormation 模板文件。但是,对此文件的更改将在将来的“推送”中被覆盖。
{
...
"LambdaEventSourceMappingName": {
...
"Properties": {
...
+ "FilterCriteria": {
+ "Filters": [
+ ...
+ ]
+ }
}
}
...
}
有没有一种方法可以向 Amplify 生成的 CloudFormation 模板添加/覆盖属性?是否可以使用 Amplify 的自定义资源来实现这一点?
英文:
Using the AWS Amplify CLI to create a Lambda trigger for a DynamoDB Table Stream. The documentation provided by Amazon is working as expected. However, I'm wanting to add filter criteria to the stream configuration. Amplify generates a CloudFormation template file. But, changes to this file will be overwritten with a future "push".
{
...
"LambdaEventSourceMappingName": {
...
"Properties": {
...
+ "FilterCriteria": {
+ "Filters": [
+ ...
+ ]
+ }
}
}
...
}
Is there a way that I can add/overwrite attributes to a CloudFormation template generated by Amplify? Can this be done with Amplify's Custom Resources?
答案1
得分: 1
在 amplify/backend/function/yourFunction/yourFunction-cloudformation-template.json
中编辑 CloudFormation 模板后,需要在执行 amplify push
之前运行 amplify env checkout dev
(将 "dev" 替换为您的环境名称)。
英文:
Once you are edited cloudformation template in amplify/backend/function/yourFunction/yourFunction-cloudformation-template.json
you need to amplify env checkout dev
(change dev with your environment name) before amplify push
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论