@@ -17,21 +17,31 @@ The CLI's usage follows with required parameters marked by asterisks.
17
17
Use this flag to use strongly consistent scan. If the flag is not used
18
18
it will default to eventually consistent scan
19
19
Default: false
20
- --createDestination
21
- Create destination table if it does not exist
22
- Default: false
23
20
--copyStreamSpecificationWhenCreating
24
21
Use the source table stream specification for the destination table
25
22
during its creation.
26
23
Default: false
24
+ --createAllGsi
25
+ Create all GSI in destination table
26
+ Default: false
27
+ --createAllLsi
28
+ Create all LSI in destination table
29
+ Default: false
30
+ --createDestination
31
+ Create destination table if it does not exist
32
+ Default: false
27
33
--destinationEndpoint
28
34
Endpoint of the destination table
29
- * --destinationRegion
35
+ * --destinationSigningRegion
30
36
Signing region for the destination endpoint
31
37
* --destinationTable
32
38
Name of the destination table
33
39
--help
34
40
Display usage information
41
+ --includeGsi
42
+ Include the following GSI in the destination table
43
+ --includeLsi
44
+ Include the following LSI in the destination table
35
45
--maxWriteThreads
36
46
Number of max threads to write to destination table
37
47
Default: 1024
@@ -44,7 +54,7 @@ The CLI's usage follows with required parameters marked by asterisks.
44
54
Default: 0
45
55
--sourceEndpoint
46
56
Endpoint of the source table
47
- * --sourceRegion
57
+ * --sourceSigningRegion
48
58
Signing region for the source endpoint
49
59
* --sourceTable
50
60
Name of the source table
@@ -87,8 +97,8 @@ To transfer to a different region, create two AmazonDynamoDBClients
87
97
with different endpoints to pass into the DynamoDBBootstrapWorker and the DynamoDBConsumer.
88
98
89
99
```java
90
- import com.amazonaws.dynamodb.bootstrap. DynamoDBBootstrapWorker;
91
- import com.amazonaws.dynamodb.bootstrap.DynamoDBConsumer;
100
+ import DynamoDBBootstrapWorker;
101
+ import com.amazonaws.dynamodb.bootstrap.consumer. DynamoDBConsumer;
92
102
import com.amazonaws.dynamodb.bootstrap.exception.NullReadCapacityException;
93
103
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
94
104
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
@@ -98,28 +108,22 @@ import java.util.concurrent.Executors;
98
108
99
109
class TransferDataFromOneTableToAnother {
100
110
public static void main(String[] args) {
101
- AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
111
+ final AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
102
112
.withRegion(com.amazonaws.regions.Regions.US_WEST_1).build();
103
- DynamoDBBootstrapWorker worker = null;
104
113
try {
105
114
// 100.0 read operations per second. 4 threads to scan the table.
106
- worker = new DynamoDBBootstrapWorker(client,
115
+ final DynamoDBBootstrapWorker worker = new DynamoDBBootstrapWorker(client,
107
116
100.0, "mySourceTable", 4);
117
+ // 50.0 write operations per second. 8 threads to scan the table.
118
+ final DynamoDBConsumer consumer = new DynamoDBConsumer(client, "myDestinationTable",
119
+ 50.0, Executors.newFixedThreadPool(8));
120
+ worker.pipe(consumer);
108
121
} catch (NullReadCapacityException e) {
109
122
System.err.println("The DynamoDB source table returned a null read capacity.");
110
123
System.exit(1);
111
- }
112
- // 50.0 write operations per second. 8 threads to scan the table.
113
- DynamoDBConsumer consumer = new DynamoDBConsumer(client, "myDestinationTable", 50.0,
114
- Executors.newFixedThreadPool(8));
115
- try {
116
- worker.pipe(consumer);
117
- } catch (ExecutionException e) {
124
+ } catch (ExecutionException | InterruptedException e) {
118
125
System.err.println("Encountered exception when executing transfer: " + e.getMessage());
119
126
System.exit(1);
120
- } catch (InterruptedException e){
121
- System.err.println("Interrupted when executing transfer: " + e.getMessage());
122
- System.exit(1);
123
127
}
124
128
}
125
129
}
@@ -128,13 +132,15 @@ class TransferDataFromOneTableToAnother {
128
132
129
133
### 2. Transfer Data From one DynamoDB Table to a Blocking Queue.
130
134
131
- The below example will read from a DynamoDB table and export to an array blocking queue. This is useful for when another application would like to consume
132
- the DynamoDB entries but does not have a setup application for it. They can just retrieve the queue (consumer.getQueue()) and then continually pop() from it
135
+ The below example will read from a DynamoDB table and export to an array blocking queue.
136
+ This is useful for when another application would like to consume
137
+ the DynamoDB entries but does not have a setup application for it.
138
+ They can just retrieve the queue (consumer.getQueue()) and then continually pop() from it
133
139
to then process the new entries.
134
140
135
141
```java
136
- import com.amazonaws.dynamodb.bootstrap.BlockingQueueConsumer;
137
- import com.amazonaws.dynamodb.bootstrap. DynamoDBBootstrapWorker;
142
+ import com.amazonaws.dynamodb.bootstrap.consumer. BlockingQueueConsumer;
143
+ import DynamoDBBootstrapWorker;
138
144
import com.amazonaws.dynamodb.bootstrap.exception.NullReadCapacityException;
139
145
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
140
146
import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder;
@@ -143,29 +149,20 @@ import java.util.concurrent.ExecutionException;
143
149
144
150
class TransferDataFromOneTableToBlockingQueue {
145
151
public static void main(String[] args) {
146
- AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
152
+ final AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard()
147
153
.withRegion(com.amazonaws.regions.Regions.US_WEST_1).build();
148
-
149
- DynamoDBBootstrapWorker worker = null;
150
-
151
154
try {
152
155
// 100.0 read operations per second. 4 threads to scan the table.
153
- worker = new DynamoDBBootstrapWorker(client, 100.0, "mySourceTable", 4);
156
+ final DynamoDBBootstrapWorker worker = new DynamoDBBootstrapWorker(client, 100.0,
157
+ "mySourceTable", 4);
158
+ final BlockingQueueConsumer consumer = new BlockingQueueConsumer(8);
159
+ worker.pipe(consumer);
154
160
} catch (NullReadCapacityException e) {
155
161
System.err.println("The DynamoDB source table returned a null read capacity.");
156
162
System.exit(1);
157
- }
158
-
159
- BlockingQueueConsumer consumer = new BlockingQueueConsumer(8);
160
-
161
- try {
162
- worker.pipe(consumer);
163
- } catch (ExecutionException e) {
163
+ } catch (ExecutionException | InterruptedException e) {
164
164
System.err.println("Encountered exception when executing transfer: " + e.getMessage());
165
165
System.exit(1);
166
- } catch (InterruptedException e){
167
- System.err.println("Interrupted when executing transfer: " + e.getMessage());
168
- System.exit(1);
169
166
}
170
167
}
171
168
}
0 commit comments