Search in sources :

Example 91 with Region

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();
}
Also used : DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Region(software.amazon.awssdk.regions.Region)

Example 92 with Region

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();
}
Also used : DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Region(software.amazon.awssdk.regions.Region)

Example 93 with Region

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) Ec2Client(software.amazon.awssdk.services.ec2.Ec2Client)

Example 94 with Region

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) Ec2Client(software.amazon.awssdk.services.ec2.Ec2Client)

Example 95 with Region

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();
}
Also used : Region(software.amazon.awssdk.regions.Region) EcsClient(software.amazon.awssdk.services.ecs.EcsClient)

Aggregations

Region (software.amazon.awssdk.regions.Region)534 S3Client (software.amazon.awssdk.services.s3.S3Client)43 RekognitionClient (software.amazon.awssdk.services.rekognition.RekognitionClient)32 DynamoDbClient (software.amazon.awssdk.services.dynamodb.DynamoDbClient)31 IamClient (software.amazon.awssdk.services.iam.IamClient)23 PersonalizeClient (software.amazon.awssdk.services.personalize.PersonalizeClient)22 Ec2Client (software.amazon.awssdk.services.ec2.Ec2Client)20 Test (org.junit.Test)17 AwsCredentialsProvider (software.amazon.awssdk.auth.credentials.AwsCredentialsProvider)15 KmsClient (software.amazon.awssdk.services.kms.KmsClient)15 URI (java.net.URI)13 CodeCommitClient (software.amazon.awssdk.services.codecommit.CodeCommitClient)13 GlueClient (software.amazon.awssdk.services.glue.GlueClient)12 Properties (java.util.Properties)11 DynamoDbEnhancedClient (software.amazon.awssdk.enhanced.dynamodb.DynamoDbEnhancedClient)11 SesClient (software.amazon.awssdk.services.ses.SesClient)11 SdkBytes (software.amazon.awssdk.core.SdkBytes)9 Route53Client (software.amazon.awssdk.services.route53.Route53Client)9 CloudTrailClient (software.amazon.awssdk.services.cloudtrail.CloudTrailClient)8 CloudWatchClient (software.amazon.awssdk.services.cloudwatch.CloudWatchClient)8