How to write item, with Null attribute, to Dynamodb through BatchWriteItem task in AWS Step function

0

I am attempting to use aws step functions with the batchwriteitem task for dynamodb.

Unfortunately, the step function throws an error suggesting "The field "NULL" is not supported by Step Functions". But this is how AWS SDK documentation suggests we label null values in API call. If the "NULL" value isn't expected, then how am I supposed to write an item, that has a Null attribute, to Dynamodb through BatchWriteItem task in AWS Step functions

Example task in Step function which is causing step function ASL error. I tried changing "NULL" to "Null" or "null". And none of these work?

"BatchWriteItem": {
    "Type": "Task",
    "End": true,
    "Parameters": {
        "RequestItems": {
            "sample-dynamodb-table": [
                {
                    "PutRequest": {
                        "Item": {
                            "PK": {
                                "S": "trash"
                            },
                            "SK": {
                                "S": "trash"
                            },
                            "value": {
                                "NULL": true
                            }
                        }
                    }
                }
            ]
        }
    },
    "Resource": "arn:aws:states:::aws-sdk:dynamodb:batchWriteItem"
}
1回答
2
承認された回答

Its a little bit funny, but its based on Java SDK V2 AttributeValue and should be set as Nul.

"BatchWriteItem": {
    "Type": "Task",
    "End": true,
    "Parameters": {
        "RequestItems": {
            "sample-dynamodb-table": [
                {
                    "PutRequest": {
                        "Item": {
                            "PK": {
                                "S": "trash"
                            },
                            "SK": {
                                "S": "trash"
                            },
                            "value": {
                                "Nul": true
                            }
                        }
                    }
                }
            ]
        }
    },
    "Resource": "arn:aws:states:::aws-sdk:dynamodb:batchWriteItem"
}
profile pictureAWS
エキスパート
回答済み 1年前
profile pictureAWS
エキスパート
レビュー済み 1年前
  • Ah wow Thank you! Where might I have found this? I had been searching for a while. Is this documented in step function ASL docs anywhere? Or maybe somewhere else?

  • I don't believe its documented, it was something I discovered recently myself. I will bring it up with the documentation team to highlight this. Same scenario occurs for other attributes with step functions following pascal casing, for example string sets which are normally SS are defined in StepFunctions as Ss.

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ