title: Delete all items in a DynamoDB table using bash with both partition and sort keys
body: <p>I'm trying to delete all items in a DynamoDB table that has both partition and sort keys using AWS CLI in bash. <a href="https://gist.github.com/pushplay/d2cac7ca1a10a5a49f6947a02657a23a" rel="noreferrer">The best thing I've found so far</a> is:</p>
  
  <pre><code>aws dynamodb scan --table-name $TABLE_NAME --attributes-to-get "$KEY" \
  --query "Items[].$KEY.S" --output text | \
  tr "\t" "\n" | \
  xargs -t -I keyvalue aws dynamodb delete-item --table-name $TABLE_NAME \
  --key "{\"$KEY\": {\"S\": \"keyvalue\"}}"
  </code></pre>
  
  <p>But this does not work with a table that has both the partition key and the sort key, and I have not yet been able to make it work with such a table. Any idea how to modify the script to make it work for a table with composite keys?</p>