use of software.amazon.awssdk.services.ec2.model.Region in project aws-doc-sdk-examples by awsdocs.
the class CreateKeyPair method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyName> \n\n" + "Where:\n" + " keyName - a key pair name (for example, TestKeyPair). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyName = args[0];
Region region = Region.US_WEST_2;
Ec2Client ec2 = Ec2Client.builder().region(region).build();
createEC2KeyPair(ec2, keyName);
ec2.close();
}
use of software.amazon.awssdk.services.ec2.model.Region in project aws-doc-sdk-examples by awsdocs.
the class DeleteKeyPair method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <keyPair> \n\n" + "Where:\n" + " keyPair - a key pair name (for example, TestKeyPair).";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String keyPair = args[0];
Region region = Region.US_WEST_2;
Ec2Client ec2 = Ec2Client.builder().region(region).build();
deleteKeys(ec2, keyPair);
ec2.close();
}
use of software.amazon.awssdk.services.ec2.model.Region in project aws-doc-sdk-examples by awsdocs.
the class DescribeReservedInstances 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_WEST_2;
Ec2Client ec2 = Ec2Client.builder().region(region).build();
describeReservedEC2Instances(ec2, instanceId);
ec2.close();
}
use of software.amazon.awssdk.services.ec2.model.Region in project aws-doc-sdk-examples by awsdocs.
the class DescribeVPCs method main.
public static void main(String[] args) {
final String USAGE = "\n" + "Usage:\n" + " <vpcId>\n\n" + "Where:\n" + " vpcId - a VPC ID that you can obtain from the AWS Management Console (for example, vpc-xxxxxf2f). \n\n";
if (args.length != 1) {
System.out.println(USAGE);
System.exit(1);
}
String vpcId = args[0];
Region region = Region.US_WEST_2;
Ec2Client ec2 = Ec2Client.builder().region(region).build();
describeEC2Vpcs(ec2, vpcId);
ec2.close();
}
use of software.amazon.awssdk.services.ec2.model.Region in project aws-doc-sdk-examples by awsdocs.
the class AllocateAddress 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();
System.out.println(getAllocateAddress(ec2, instanceId));
ec2.close();
}
Aggregations