简体   繁体   English

具有特定 EBS 卷大小 Java 开发工具包的 Amazon EC2 实例

[英]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.我正在使用 java SDK 来启动实例,并且运行良好。 On issue is that the volume is 8GB问题是卷是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. RunInstancesRequest类中似乎没有任何内容,但withBlockDeviceMappings似乎创建了一个单独的卷。 How do you specify the size of the volume?如何指定卷的大小?

com.amazonaws.services.ec2.model.Volume will help you. com.amazonaws.services.ec2.model.Volume将为您提供帮助。

Mehtod: setSize(Integer size)方法:setSize(整数大小)

API Documentation API 文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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