use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.
the class Scenario method main.
public static void main(String[] args) throws IOException {
final String USAGE = "\n" + "Usage:\n" + " <fileName>\n\n" + "Where:\n" + " fileName - the path to the moviedata.json file that you can download from the Amazon DynamoDB Developer Guide.\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String tableName = "Movies";
String fileName = args[0];
Region region = Region.US_EAST_1;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
System.out.println("******* Creating an Amazon DynamoDB table named Movies with a key named year and a sort key named title.");
createTable(ddb, tableName);
System.out.println("******* Loading data into the Amazon DynamoDB table.");
loadData(ddb, tableName, fileName);
System.out.println("******* Getting data from the Movie table.");
getItem(ddb);
System.out.println("******* Putting a record into the Amazon DynamoDB table.");
putRecord(ddb);
System.out.println("******* Updating a record.");
updateTableItem(ddb, tableName);
System.out.println("******* Scanning the Amazon DynamoDB table.");
scanMovies(ddb, tableName);
System.out.println("******* Querying the Movies released in 2013.");
queryTable(ddb);
System.out.println("******* Deleting the Amazon DynamoDB table.");
deleteDynamoDBTable(ddb, tableName);
ddb.close();
}
use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.
the class UpdateItem method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " UpdateItem <tableName> <key> <keyVal> <name> <updateVal>\n\n" + "Where:\n" + " tableName - the Amazon DynamoDB table (for example, Music3).\n" + " key - the name of the key in the table (for example, Artist).\n" + " keyVal - the value of the key (for example, Famous Band).\n" + " name - the name of the column where the value is updated (for example, Awards).\n" + " updateVal - the value used to update an item (for example, 14).\n" + " Example:\n" + " UpdateItem Music3 Artist Famous Band Awards 14\n";
if (args.length != 5) {
System.out.println(USAGE);
System.exit(1);
}
String tableName = args[0];
String key = args[1];
String keyVal = args[2];
String name = args[3];
String updateVal = args[4];
Region region = Region.US_EAST_1;
DynamoDbClient ddb = DynamoDbClient.builder().region(region).build();
updateTableItem(ddb, tableName, key, keyVal, name, updateVal);
ddb.close();
}
use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.
the class ReleaseAddress method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <allocId>\n\n" + "Where:\n" + " allocId - an allocation ID value that you can obtain from the AWS Console. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String allocId = args[0];
Region region = Region.US_WEST_2;
Ec2Client ec2 = Ec2Client.builder().region(region).build();
releaseEC2Address(ec2, allocId);
ec2.close();
}
use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.
the class TerminateInstance method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <instanceId>\n\n" + "Where:\n" + " instanceId - an instance id value that you can obtain from the AWS Console. \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String instanceId = args[0];
Region region = Region.US_EAST_1;
Ec2Client ec2 = Ec2Client.builder().region(region).build();
terminateEC2(ec2, instanceId);
ec2.close();
}
use of software.amazon.awssdk.regions.Region in project aws-doc-sdk-examples by awsdocs.
the class ListTaskDefinitions method main.
public static void main(String[] args) {
final String usage = "\n" + "Usage:\n" + " <clusterArn> <taskId> \n\n" + "Where:\n" + " clusterArn - the ARN of an ECS cluster.\n" + " taskId - the task Id value.\n";
if (args.length != 2) {
System.out.println(usage);
System.exit(1);
}
String clusterArn = args[0];
String taskId = args[1];
Region region = Region.US_EAST_1;
EcsClient ecsClient = EcsClient.builder().region(region).build();
getAllTasks(ecsClient, clusterArn, taskId);
ecsClient.close();
}
Aggregations