skip to Main Content

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?

3

Answers


  1. 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.

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
  3. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search