title: How do i get an item from dynamodb table?
body: <p>Im trying to check if an item exists in my dynamodb table using the code below:
  I want to be able to run something once I can retrieve the item. The partition key is <strong>envName</strong> and the sort key is <strong>configurationName</strong></p>
  <pre><code>package com.dev.newlibs;
  
  //all relevant imports added here
  
  public class updatenewCMDB {
      
      public static void main(String[] args)throws Exception {
          String tableName = &quot;env_dashboard&quot;;
          String configurationName = &quot;component&quot;;
          String configurationNameValue = &quot;ec2&quot;;
          String envName = &quot;env_Name&quot;;
          String envNameValue = &quot;dev&quot;;
          String status = &quot;status&quot;; 
          String statusValue = &quot;COMPLETE&quot;;
  
          DynamoDbClient client = DynamoDbClient.builder()
                  .region(Region.EU_WEST_1)
                  .build();
              
              client.close();
  
              updateEnvDashboard(client, tableName, configurationName, configurationNameValue, envName, envNameValue, status, statusValue,);
      }
  
      public static void updateEnvDashboard(DynamoDbClient client,
                                           String tableName, 
                                           String configurationName,
                                           String configurationNameValue,
                                           String envName,
                                           String envNameValue,
                                           String status, 
                                           String statusValue,) throws Exception {
  
          
          //Get item to see if it exists
          HashMap&lt;String,AttributeValue&gt; itemToGet = new HashMap&lt;String,AttributeValue&gt;();
          
          itemToGet.put(configurationName, AttributeValue.builder().s(configurationNameValue).build());
          itemToGet.put(status, AttributeValue.builder().s(statusValue).build());
          itemToGet.put(envName, AttributeValue.builder().s(envNameValue).build());
  
  
          GetItemRequest request = GetItemRequest.builder()
                  .key(itemToGet)
                  .tableName(tableName)
                  .build();
          
          //run a get request and see what is returned. do something depending on what is returned
          
          try {
              Map&lt;String,AttributeValue&gt; returnedItem = client.getItem(request).item();
              if (returnedItem != null) {
                  Set&lt;String&gt; keys = returnedItem.keySet();
                  System.out.println(&quot;Amazon DynamoDB table attributes: \n&quot;);
  
                  for (String key1 : keys) {
                      System.out.format(&quot;%s: %s\n&quot;, key1, returnedItem.get(key1).toString());
                  }
              } else {
                  System.out.format(&quot;No item found with the key %s!\n&quot;);
              }
              
          } catch (DynamoDbException e){
              e.printStackTrace();
              System.exit(1);
          }
          
      }
  }
  
  </code></pre>
  <p>When running this i get the error:</p>
  <pre><code>software.amazon.awssdk.services.dynamodb.model.DynamoDbException: The provided key element does not match the schema
  </code></pre>
  <p>what am i missing here? i've tried to follow the getItem example from the official aws repo</p>