First of all I have Primary Key "userId", and the sort key is "dataDateTime". To transform JSON I'm using JQ tool.
aws dynamodb scan --table-name dev-data-table --attributes-to-get "userId" "dataDateTime" | jq .Items[] -c | xargs -t -0 -d '\n' -I keyvalue aws dynamodb delete-item --table-name dev-data-table --key ''keyvalue''Be careful, this method is very slow, up to 10K items.
Have a good day.