I've been fiddling for a while with updating records in DynamoDB using the AWS CLI from PowerShell. I can't seem to update a value that contains a whitespace. See below command where 2021-11-17 14:48:41 contains the whitespace. I've tried a lot of different quote and escape combinations, but haven't been successful. Any help would be appreciated.
This is from a Windows 2016 server running AWS CLI 1.18.216. In bash or PowerShell Core on MacOS I don't experience this issue.
Command:
aws dynamodb update-item `
--table-name $TableName `
--key $KeyStackJson `
--update-expression 'SET #H = :h,#D = :d,#E = :e' `
--expression-attribute-names $AttributeNameJson `
--expression-attribute-values '{\":h\":{\"S\":\"0.0.189-alpha\"},\":d\":{\"S\":\"test\"},\":e\":{\"S\":\"2021-11-17 14:48:41\"}}'
Output:
Unknown options: 14:48:41"}}
To escape double quotes in powershell use following `". Example:
"{\`"id\`":{\`"S\`":\`"1ec9b5bb-e271-4c40-bccd-045c9d26434e\`"}}"
produces following string for DynamoDB
"{"id":{"S":"1ec9b5bb-e271-4c40-bccd-045c9d26434e"}}"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.