如何向由AWS Amplify创建的DynamoDB Stream CloudFormation模板添加FilterCriteria?

huangapple go评论63阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年7月6日 11:44:25
  • 转载请务必保留本文链接:https://go.coder-hub.com/76625359.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定