英文:
Reusing EC2 instance?
问题
我开始使用Amazon EC2进行GPU上的ML训练。
启动并通过SSH连接到我的EC2(Spot)实例后,我想要做以下工作:
- 克隆我的GitHub存储库(首次设置访问权限)
- 下载数据集
- 准备数据集(解压缩,复制到适当的目录等)
- 准备Python环境
- 运行训练
我的问题是:一旦我停止Amazon EC2实例,我是否能够重用我的设置工作,还是所有内容都会丢失,因此如果我想再次进行训练,就必须重新进行整个设置?
英文:
I'm starting with Amazon EC2 usage for some ML training on a GPU.
What I want to do after I launch and ssh to my EC2 (Spot) instance:
- clone my GitHub repository (first setup access)
- download dataset
- prepare dataset (unzip, copy to aproprate directories, etc.)
- prepare python environment
- run the training
My question is: once I stop the Amazon EC2 instance, will I be able to reuse my setup work, or it will all be lost, so once I want to do training again, I would have to do the whole setup again?
答案1
得分: 1
可以停止和重新启动EC2实例,但仅限于那些使用EBS支持的实例。这适用于持久性抢占式实例以及按需实例。请注意,“持久性”不是抢占式实例的默认选项,但您可以在高级选项 > 请求类型下请求持久性抢占式实例。
请查看停止和启动您的实例。
使用这些步骤来检查您的EC2实例的根设备类型是否为EBS,或者使用这些步骤来检查AMI的根设备类型是否为EBS。
英文:
Yes, you can stop and restart EC2 instances but only those that are EBS-backed. This applies to persistent spot instances as well as on-demand instances. Note that 'persistent' is not the default option for spot instances, but you can request a persistent spot instance under Advanced options > Request type.
See Stop and start your instance.
Use these steps to check that the root device type of your EC2 instance is EBS or use these steps to check that the root device type of an AMI is EBS.
答案2
得分: 1
你无法亲自停止实例,但当发生抢占式实例中断时,你可以选择停止该实例。
在这种情况下,是的,你可以重新使用该设置。根据这篇文章:
启动/停止功能为您提供了对您的抢占式实例更多的控制权,除了现有的中断行为。当您停止您的抢占式实例时,EBS根设备和附加的EBS卷被保存,其数据保持不变。在重新启动时,EBS根设备将恢复到其先前的状态,以前附加的数据卷将被重新附加,并且实例将保留其实例ID。
此功能仅适用于持久性抢占式请求。在停止实例时,您不会被收取实例使用费。EBS卷存储按标准费率收费。您可以随时取消您的抢占式请求以终止已停止的实例。此功能仅适用于根设备为Amazon EBS卷的实例。
英文:
You will not be able to physically stop the instance yourself, however you can choose to have the instance stopped when a spot instance interruption occurs.
And in that case, yes, you will be able to reuse the setup. From this article:
> The start/stop provides you more control over your Spot Instances in addition to the existing interruption behavior. When you stop your Spot Instance, the EBS root device and attached EBS volumes are saved and their data persists. Upon restart, the EBS root device is restored from its prior state, previously attached data volumes are reattached, and the instance retains its instance ID.
> This feature is available for persistent Spot requests. You will not be charged for instance usage while your instance is stopped. EBS volume storage is charged at standard rates. You should cancel your Spot request at any time to terminate stopped instances. This feature is only available for instances with an Amazon EBS volume as their root device.
答案3
得分: 0
是的,您将能够重新使用您配置的所有内容,无需重新设置。
您可以在https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instances-and-amis.html#instance-stopping-starting-terminating中查看。
当实例停止时,实例会执行正常的关闭,然后转换为停止状态。其所有的Amazon EBS卷保持连接,您可以在以后的某个时候再次启动该实例。
英文:
Yes, you will be able to reuse everything you have configured and will not need to set it up again.
You can see in https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instances-and-amis.html#instance-stopping-starting-terminating
> When an instance is stopped, the instance performs a normal shutdown, and then transitions to a stopped state. All of its Amazon EBS volumes remain attached, and you can start the instance again at a later time.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论