简体   繁体   中英

Amazon EC2 instance with a specific EBS Volume Size Java SDK

I'm using the java SDK to spin up instances and it's working well. On issue is that the volume is 8GB

RunInstancesRequest runInstancesRequest = new RunInstancesRequest();
runInstancesRequest.withImageId(AMI_ID).withInstanceType(INSTANCE_TYPE).withMinCount(1).withMaxCount(1)
    .withKeyName(KEY_NAME).withSecurityGroups(SECURITY_GROUP).withMonitoring(true);
RunInstancesResult runInstancesResult = ec2.runInstances(runInstancesRequest);

There doesn't seem to be anything in the RunInstancesRequest class but withBlockDeviceMappings seems to create a separate volume. How do you specify the size of the volume?

com.amazonaws.services.ec2.model.Volume will help you.

Mehtod: setSize(Integer size)

API Documentation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM