[英]create EC2 instance in JAVA AWS sdk using snapshot
I can create an EC2 instance using java sdk using some image. 我可以使用Java sdk和一些图像来创建EC2实例。 Currently I am creating it like this
目前,我正在像这样创建它
private static void createInstance()
throws AmazonServiceException, AmazonClientException, InterruptedException
{
RunInstancesRequest runInstancesRequest = new RunInstancesRequest()
.withInstanceType("m1.small")
.withImageId("ami-e565ba8c")
.withMinCount(1)
.withMaxCount(1)
.withKeyName("mykey")
;
RunInstancesResult runInstances = ec2.runInstances(runInstancesRequest);
}
Can someone please guide me that how can I create ec2 instance using snapshot of image instead of image itself? 有人可以指导我如何使用图像快照而不是图像本身创建ec2实例吗?
You will have to create image from the snapshot first. 您将必须首先从快照创建映像。 Then you can launch instance from that image.
然后,您可以从该映像启动实例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.