public ResultList<ResultItem> fetch(AmazonSimpleDB sdb, String domain, ResultList<ResultItem> in, String nextToken) { String sql = "select * from " + domain + " limit 100"; ResultList<ResultItem> select = SimpleDB.select(sdb, ResultItem.class, sql, nextToken); if (in == null) { in = select; } else { in.addAll(select); } if (select.getNextToken() == null) { return in; } return fetch(sdb, domain, in, select.getNextToken()); } public void copyDomain() { ClientConfiguration configuration = new ClientConfiguration(); AmazonSimpleDB sdb = new AmazonSimpleDBClient(new BasicAWSCredentials( "*********************", "******************************"), configuration); sdb.setEndpoint("sdb.ap-northeast-1.amazonaws.com"); String copyFrom = "****************"; String copyTo = "****************"; sdb.createDomain(new CreateDomainRequest(copyTo)); ResultList<ResultItem> result = fetch(sdb, copyFrom, null, null); for (ResultItem item : result) { String itemName = item.getItemName(); ReplaceableAttributeList list = new ReplaceableAttributeList(); Iterator<Entry<String, String>> iterator = item.entrySet().iterator(); while (iterator.hasNext()) { Entry<String, String> next = iterator.next(); String key = next.getKey(); String value = next.getValue(); list.add(key, value, true); } sdb.putAttributes(new PutAttributesRequest(copyTo, itemName, list)); } }