title: Best way to delete contents from DynamoDB Table (Using Jenkins + CloudFormation)
body: <p>I have a Cloudformation template that creates a DynamoDB table.  </p>
  
  <p>Within that same Jenkins pipeline, I have a pipeline script that has multiple stages.  For one of those stages, I actually deploy this same CloudFormation template.  What I tried to do in Jenkins was make 1 stage that deletes the DynamoDB table: </p>
  
  <pre><code>   stage('Delete DynamoDB Table'){
          sh "aws dynamodb delete-table --table-name ThisTable --region us-east-1"
      }
  </code></pre>
  
  <p>Then I deploy the CFT</p>
  
  <pre><code>   stage('Deploy CloudFormation Template'){
  </code></pre>
  
  <p>And then I upload data into DynamoDB</p>
  
  <pre><code>   stage('Upload Data to Dynamo'){
  </code></pre>
  
  <p>My problem is, when I delete the DynamoDB table outright, my Deploy CFT stage cannot run because it does not like that.  So the Jenkins pipeline actually fails before I reach the the upload stage.  </p>
  
  <p>Does anyone know of a better way to delete items from DynamoDB?  I was told that you could not truncate a DynamoDB table and the best way was to just drop the table and recreate it.</p>