//snippet-sourcedescription:[UpdateTable.java demonstrates how to update an AWS DynamoDB table]
//snippet-keyword:[SDK for Java 2.0]
//snippet-keyword:[Code Sample]
//snippet-service:[dynamodb]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[]
//snippet-sourceauthor:[soo-aws]

/*
   Copyright 2010-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
   This file is licensed under the Apache License, Version 2.0 (the "License").
   You may not use this file except in compliance with the License. A copy of
   the License is located at
    http://aws.amazon.com/apache2.0/
   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
   CONDITIONS OF ANY KIND, either express or implied. See the License for the
   specific language governing permissions and limitations under the License.
*/

package com.example.dynamodb;
// snippet-start:[dynamodb.java2.update_table.complete]
// snippet-start:[dynamodb.java2.update_table.import]
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput;
import software.amazon.awssdk.services.dynamodb.DynamoDbClient;
import software.amazon.awssdk.services.dynamodb.model.UpdateTableRequest;
import software.amazon.awssdk.services.dynamodb.model.DynamoDbException;
// snippet-end:[dynamodb.java2.update_table.import]

/**
 * Updates an AWS DynamoDB table (change provisioned throughput).
 *
 * This code expects that you have AWS credentials set up, as described here:
 * http://docs.aws.amazon.com/java-sdk/latest/developer-guide/setup-credentials.html
 */
public class UpdateTable {

    public static void main(String[] args) {
        final String USAGE = "\n" +
                "Usage:\n" +
                "    UpdateTable <table> <read> <write>\n\n" +
                "Where:\n" +
                "    table - the table to put the item in (i.e., Music3)\n" +
                "    read  - the new read capacity of the table (i.e., 16)\n" +
                "    write - the new write capacity of the table (i.e., 10)\n\n" +
                "Example:\n" +
                "    UpdateTable Music3 16 10\n";

        if (args.length < 3) {
            System.out.println(USAGE);
            System.exit(1);
        }

        // snippet-start:[dynamodb.java2.update_table.main]
        String tableName = args[0];
        Long readCapacity = Long.parseLong(args[1]);
        Long writeCapacity = Long.parseLong(args[2]);

        // Create the DynamoDbClient object
        Region region = Region.US_WEST_2;
        DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();

        System.out.format(
                "Updating %s with new provisioned throughput values\n",
                tableName);
        System.out.format("Read capacity : %d\n", readCapacity);
        System.out.format("Write capacity : %d\n", writeCapacity);

        ProvisionedThroughput tableThroughput = ProvisionedThroughput.builder()
                .readCapacityUnits(readCapacity)
                .writeCapacityUnits(writeCapacity)
                .build();

        UpdateTableRequest request = UpdateTableRequest.builder()
                .provisionedThroughput(tableThroughput)
                .tableName(tableName)
                .build();

        try {
            ddb.updateTable(request);
        } catch (DynamoDbException e) {
            System.err.println(e.getMessage());
            System.exit(1);
        }

        // snippet-end:[dynamodb.java2.update_table.main]
        System.out.println("Done!");
    }
}
// snippet-end:[dynamodb.java2.update_table.complete]

@@ -66,26 +66,29 @@
  update an A
-WS
+mazon
  DynamoDB ta
@@ -183,24 +183,31 @@
 ervice:%5B
-d
+Amazon D
 ynamo
-db
+DB
 %5D%0D%0A//sni
@@ -260,16 +260,24 @@
 cedate:%5B
+2/5/2020
 %5D%0D%0A//sni
@@ -300,10 +300,15 @@
 r:%5Bs
-oo
+cmacdon
 -aws
@@ -333,18 +333,8 @@
 ght 
-2010-2020 
 Amaz
@@ -886,63 +886,8 @@
 b;%0D%0A
-// snippet-start:%5Bdynamodb.java2.update_table.complete%5D
 %0D%0A//
@@ -2263,69 +2263,8 @@
 %0D%0A%0D%0A
-        // snippet-start:%5Bdynamodb.java2.update_table.main%5D%0D%0A
     
@@ -2568,32 +2568,301 @@
 on).build();%0D%0A%0D%0A
+        updateDynamoDBTable(ddb, tableName, readCapacity, writeCapacity);%0D%0A    %7D%0D%0A%0D%0A    // snippet-start:%5Bdynamodb.java2.update_table.main%5D%0D%0A    public static void updateDynamoDBTable(DynamoDbClient ddb, String tableName,  Long readCapacity, Long writeCapacity  ) %7B%0D%0A%0D%0A
         System.o
@@ -3812,59 +3812,4 @@
 %0A%7D%0D%0A
-// snippet-end:%5Bdynamodb.java2.update_table.complete%5D%0D%0A

Update UpdateTable.java