amazon-web-services - 无法从 AWS StepFunctions 正确插入 DynamoDB 项目

标签 amazon-web-services amazon-dynamodb aws-step-functions

我在 AWS StepFunctions 中编写了一个状态,以将项目插入到 DynamoDB 表中,如下所示。 Lambda 状态的输出转到 DynamoDB 状态下方的输入。

"States":{
   "Update the order table":{
      "Type":"Task",
      "Resource":"arn:aws:states:::dynamodb:putItem",
      "Parameters":{
         "TableName":"OrderTable",
         "Item":{
            "OrderId":{
               "S":"$.OrderId"
            },
            "ItemName":{
               "S":"$.ItemName"
            },
            "Price":{
               "S":"$.Price"
            },
            "CC":{
               "S":"$.CC"
            }
         }
      },
      "End":true
   }
}

文字字符串“$.OrderId”、“$.ItemName”和其他字符串将被插入到 DynamoDB 表中,而不是来自 Lambda 函数的值。

enter image description here

因此,我删除了“$.OrderId”周围的双引号,并收到以下错误。

enter image description here

enter image description here

DynamoDB 状态的输入是正确的,但我仍然无法将 Lambda 的输出插入到 DynamoDB 表中。

enter image description here

如有任何帮助,我们将不胜感激。

最佳答案

这就是您的任务定义的样子。请注意每个项目属性的数据类型后面的 $ 符号。

"States":{
   "Update the order table":{
      "Type":"Task",
      "Resource":"arn:aws:states:::dynamodb:putItem",
      "Parameters":{
         "TableName":"OrderTable",
         "Item":{
            "OrderId":{
               "S.$":"$.OrderId"
            },
            "ItemName":{
               "S.$":"$.ItemName"
            },
            "Price":{
               "S.$":"$.Price"
            },
            "CC":{
               "S.$":"$.CC"
            }
         }
      },
      "End":true
   }
}

关于amazon-web-services - 无法从 AWS StepFunctions 正确插入 DynamoDB 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63416789/

相关文章:

node.js - 上传一个pg数据库

amazon-web-services - S3 Select 可以搜索多个对象吗?

performance - 在效率方面,GetItem/BatchGetItem 与查询和扫描 DynamoDB 表相比如何?

node.js - DynamoDB 支持的 NodeJS lambda 函数的输入验证

amazon-web-services - Fn :GetAtt Not returning StateMachine. 名称为字符串

aws-step-functions - 如何编辑现有状态机(步进函数)?

bash - 如何使用 aws cli 命令仅显示来自 s3 存储桶的目录

php - 如何在 AWS Amazon Linux AMI 中安装任何 php 扩展?

amazon-web-services - 如何检查dynamodb表中是否存在项目?

amazon-web-services - API网关集成响应映射: parse statusCode and body from Step Function output