title: One or more parameter values were invalid dynamoDB + Java
body: <p>I am trying to create a table in DynamoDB. I could use DynamoDB console but I prefer doing it via Java. But the following code is giving exception and I can't find why..</p>
  
  <p>Please check the following code..</p>
  
  <pre><code>String serviceRef = "ServiceRef";
  ArrayList&lt;KeySchemaElement&gt; keySchema = new ArrayList&lt;KeySchemaElement&gt;();
  keySchema.add(new KeySchemaElement()
          .withAttributeName("ServiceID")
          .withKeyType(KeyType.HASH));
  
  ArrayList&lt;AttributeDefinition&gt; attributeDefinitions = new ArrayList&lt;AttributeDefinition&gt;();
  attributeDefinitions.add(new AttributeDefinition()
          .withAttributeName("ServiceID")
          .withAttributeType(ScalarAttributeType.N)
          .withAttributeName("ServiceName")
          .withAttributeType(ScalarAttributeType.S)
          .withAttributeName("CreatedDateUTC")
          .withAttributeType(ScalarAttributeType.N)
          .withAttributeName("UpdatedDateUTC")
          .withAttributeType(ScalarAttributeType.N)
          .withAttributeName("IsDeleted")
          .withAttributeType(ScalarAttributeType.B));
  
  CreateTableRequest request = new CreateTableRequest()
          .withTableName(serviceRef)
          .withKeySchema(keySchema)
          .withAttributeDefinitions(attributeDefinitions)
          .withProvisionedThroughput(
                  new ProvisionedThroughput().withReadCapacityUnits(5L).withWriteCapacityUnits(1L));
  
  System.out.println("Issuing create table request for: " + serviceRef);
  dynamoDBClient.createTable(request);
  System.out.println("Waiting for table Name: " + serviceRef + " to be created...");
  try {
      Tables.awaitTableToBecomeActive(dynamoDBClient, serviceRef);
  } catch (InterruptedException e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>What is wrong with this code? 
  The error it is giving is - </p>
  
  <pre><code>Exception in thread "main" com.amazonaws.AmazonServiceException: One or more parameter values were invalid: Some index key attributes are not defined in AttributeDefinitions. Keys: [ServiceID], AttributeDefinitions: [IsDeleted] (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: SA8P5UUVH37T8P1R7F6VVPP357VV4KQNSO5AEMVJF66Q9ASUAAJG)
      at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1219)
      at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:803)
      at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:505)
      at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:317)
      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:1803)
      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.createTable(AmazonDynamoDBClient.java:832)
      at com.rit.randemmiddleware.controller.TestMain.main(TestMain.java:38)
  </code></pre>
  
  <p>Also what to use in space of </p>
  
  <pre><code>Tables.awaitTableToBecomeActive(dynamoDBClient, serviceRef);
  </code></pre>
  
  <p>As it is showing deprecated.</p>