title: Is It possible to change value of Range key in DynamoDB Table?
body: <p>I know it may be a very silly question, but I am new to DynamoDB.</p>
  
  <p>My doubt is is it possible to update the value of a Range Key in DynamoDB.</p>
  
  <p>Suppose My Table is "TEST"</p>
  
  <pre><code>{
  ID : PK/HK
  Date : RK
  Name : GSI 
  Add : LSI
  }
  </code></pre>
  
  <p>I want to modify <code>Date</code> Attribute.</p>
  
  <p>Initial Values in Table was:</p>
  
  <pre><code>{
  ID = "344"
  Date = "5656"
  Name = "ABC"
  }
  </code></pre>
  
  <p>Running this code below. I am able to change the <code>Name</code> Attribute which is GSI.</p>
  
  <pre><code>Map&lt;String,AttributeValue&gt; item = new HashMap&lt;String,AttributeValue&gt;();
  item.put("ID", new AttributeValue("344"));
  item.put("Date", new AttributeValue("5656"));
  
  Map&lt;String,AttributeValueUpdate&gt; item1 = new HashMap&lt;String,AttributeValueUpdate&gt;();
  
  AttributeValueUpdate update = new AttributeValueUpdate().withValue(new AttributeValue("AMIT")).withAction("PUT");
  item1.put("Name", update);
  
  
  UpdateItemRequest updateItemreq = new UpdateItemRequest("Test",item,item1);
  UpdateItemResult updateItemres = dynamoDBUSEast.updateItem(updateItemreq);
  </code></pre>
  
  <p>But When I change this line</p>
  
  <pre><code>item1.put("Name", update);
  </code></pre>
  
  <p>with </p>
  
  <pre><code> item1.put("Date", update);
  </code></pre>
  
  <p>I am  getting some error as</p>
  
  <pre><code>Exception in thread "main" com.amazonaws.AmazonServiceException: One or more parameter values were invalid: Cannot update attribute Date. This attribute is part of the key (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: HRRP24Q7C48AMD8ASAI992L6MBVV4KQNSO5AEMVJF66Q9ASUAAJG)
      at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:820)
      at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:439)
      at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:245)
      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.invoke(AmazonDynamoDBClient.java:2908)
      at com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient.updateItem(AmazonDynamoDBClient.java:1256)
  </code></pre>
  
  <p>So Is it possible to change the range Key value?</p>