title: What is the best way to check if table exists in DynamoDB?
body: <p>What is the best way to check if table exists in DynamoDb?</p>
  
  <p>I would appreciate it if the code would be in PHP.</p>
  
  <p>Either active or not.</p>
  
  <p><em>*</em> Added later as an example to various cases for error code 400</p>
  
  <p>It's very easy to check if the table exist, it can have one of the following 
  TableStatus => CREATING, ACTIVE, DELETING or UPDATING</p>
  
  <p>but in case i get error 400 it can mean more than one thing.</p>
  
  <p>1) sent null string as a table name by mistake.</p>
  
  <p>[x-aws-body] => {"TableName":""}
          )</p>
  
  <pre><code>[body] =&gt; CFSimpleXML Object
      (
          [__type] =&gt; com.amazon.coral.validate#ValidationException
          [message] =&gt; The paramater 'tableName' must be at least 3 characters long and at most 255 characters long
      )
  
  [status] =&gt; 400
  </code></pre>
  
  <p>2) syntax error in the command sent to DynamoDB, for example writting tabel_name instead of table_name.</p>
  
  <p>[x-aws-body] => {"TabelName":"test7"}
          )</p>
  
  <pre><code>[body] =&gt; CFSimpleXML Object
      (
          [__type] =&gt; com.amazon.coral.validate#ValidationException
          [message] =&gt; The paramater 'tableName' is required but was not present in the request
      )
  
  [status] =&gt; 400
  </code></pre>
  
  <p>3) I would guess but didn't check, if I exceed at that same time the provisioned capacity on the table.</p>