Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is lower cost, Sagemaker or EC2?

For example, ml.p2.8xlarge for training job at ap-northeast on Sagemaker takes 16.408 USD / hour, but p2.8xlarge for on-demand at ap-northeast on Ec2 takes 12.336 USD/hour. Is it cheap to just train the DL models on Ec2 rather than Sagemaker if we only use it for training?

like image 490
Yu Sato Avatar asked Sep 06 '18 07:09

Yu Sato


People also ask

What is the cheapest instance type in AWS?

nano, the newest Amazon EC2 burstable-performance instance. Starting at only $4.75 per month ($0.0065 per hour), it is the lowest priced Amazon EC2 instance.

Does SageMaker need EC2?

SageMaker runs the infrastructure for these components using EC2 resources dedicated to yourself. These EC2 resources can be mapped to your VPC environment allowing you to apply your network level controls, such as security groups, to the notebooks, training jobs, and hosted ML models.

Is SageMaker free in AWS?

Amazon SageMaker is free to try. As part of the AWS Free Tier, you can get started with Amazon SageMaker for free. Your free tier starts from the first month when you create your first SageMaker resource.

How much will my EC2 instance cost?

AWS provides a free reporting tool called AWS Cost Explorer that enables you to analyze the cost and usage of your EC2 instances and the usage of your Reserved Instances. You can view data up to the last 13 months, and forecast how much you are likely to spend for the next three months.


2 Answers

I've listed some pros and cons from experience...

..., as opposed to marketing materials. If I were to guess, I'd say you have a much higher chance to experience all the drawbacks of SageMaker, than any one of the benefits.

Drawbacks

  • Cloud vendor lock in: free improvements in the open source projects in the future and better prices in competitor vendors are difficult to get. Why don't AWS invest developers in JupyterLab, they have done limited work in open source. Find some great points here, where people have experienced companies using as few AWS services as possible with good effect.
  • SageMaker instances are currently 40% more expensive than their EC2 equivalent.
  • Slow startup, it will break your workflow if every time you start the machine, it takes ~5 minutes. SageMaker Studio apparently speeds this up, but not without other issues. This is completely unacceptable when you are trying to code or run applications.
  • SageMaker Studio is the first thing they show you when you enter SageMaker console. It should really be the last thing you consider.
    • SageMaker Studio is more limited than SageMaker notebook instances. For example, you cannot mount an EFS drive.I spoke to a AWS solutions architect, and he confirmed this was impossible (after looking for the answer all over the internet). It is also very new, so there is almost no support on it, even by AWS developers.
  • Worsens the disorganised Notebooks problem. Notebooks in a file system can be much easier to organise than using JupyterLab. With SageMaker Studio, a new volume gets created and your notebooks lives in there. What happens when you have more than 1...
  • Awful/ limited terminal experience, coupled with tedious configuration (via Lifecycle configuration scripts, which require the Notebook to be turned off just to edit these scripts). Additionally, you cannot set any lifecycle configurations for Studio Notebooks.
  • SageMaker endpoints are limited compared to running your own server in an EC2 instance.
  • It may seem like it allows you to skip certain challenges, but in fact it provides you with more obscure challenges that no one has solved. Good luck solving them. The rigidity of SageMaker and lack of documentation means lots of workarounds and pain. This is very expensive.

Benefits

These revolve around the SageMaker SDK (the Sagemaker console and SageMaker SDK) (please comment or edit if you found any more benefits)

  • Built in algorithms (which you can easily just import in your machine learning framework of choice): I would say this is worse than using open source alternatives.
  • Training many models easily during hyperparameter search YouTube video by AWS (a fast way to spend money)
  • Easily create machine learning related AWS mechanical turk tasks. However, mturk is very limited within SageMaker, so youre better off going to mturk yourself.

My suggestion

If you're thinking about ML on the cloud, don't use SageMaker. Spin up a VM with a prebuilt image that has PyTorch/ TensorFlow and JupyterLab and get the work done.

like image 164
Ben Butterworth Avatar answered Oct 10 '22 15:10

Ben Butterworth


You are correct about EC2 being cheaper than Sagemaker. However you have to understand their differences.

  • EC2 provides you computing power
  • Sagemaker (try to) provides a fully configured environment and computing power with a seamless deployment model for you to start training your model on day one

If you look at Sagemaker's overview page, it comes with Jupyter notebooks, pre-installed machine learning algorithms, optimized performance, seamless rollout to production etc.

Note that this is the same as self-hosting a EC2 MYSQL server and utilizing AWS managed RDS MYSQL. Managed services always appears to be more expensive, but if you factor in the time you have to spent maintaing server, updating packages etc., the extra 30% cost may be worth it.

So in conclusion if you rather save some money and have the time to set up your own server or environment, go for EC2. If you do not want to be bothered with these work and want to start training as soon as possible, use Sagemaker.

like image 29
Victor Wong Avatar answered Oct 10 '22 15:10

Victor Wong