Setup problems: AWS

Thank you @z0k! I can ssh into the instance, but only found these four folders in the home directory:

anaconda2
downloads (which has a cuda folder and a .deb file for cuda installation)
git (which is empty)
nbs (which is also empty)

I do not see the deeplearning1 folder…

Sorry, what I should have said is that you can clone the repo to get the files

git clone https://github.com/fastai/courses.git

Note that there are no data files - you have to download those separately from Kaggle (or here for the processed version of dogs versus cats).

Hey guys!
I dont know, if it is a right topic, but how much money do you spent on servertime in order to complete the course?
I have only around 100~200$ avaiable, and woundering is it even worth to strat the whole thing…

My first month of the course was about $42 (U.S.), but I’ve only done the first 3 lessons. The most expensive part (unless you forget to shut off your p2!) is the EBS storage volumes which are created by default at 128GB. That was about half the expense.

So if cost is a concern (and when isn’t it, I mean really!) you can edit the t2 and p2 setup files to create smaller volumes to start with. There is almost no way to make them smaller, but they are easy to make bigger, so if you really get into it and need more space you can increase the size with a couple clicks.

EDIT 4/24/17
Evidently the Amazon Image Snapshot expects a partition of 128GB so you can’t just edit the setup.sh. Sorry for misleading folks. I would still recommend finding a way to start with less disk space if you can figure it out. ~~Look in the setup_instance.sh file and find the line ...{ \"VolumeSize\": 128... and edit that to a smaller number. You get 30 with the free tier total – so if you setup both t2 and p2 at 15 you won’t go over. Of course I don’t know if you can fit everything in 15 GB. ~~
End EDIT

One other trick is that the instances are only billed in full hour increments each time you start and stop. So if you start an instance run for 10 minutes, stop it, start it again, run for another 10 minutes, stop it again, you will be charged for two hours. So don’t do that!

Here are my recommendations based and things I wish I had known given my experience and my budget.

  • Edit volume size to 30, increase it if needed later.
  • Only set up a p2.xlarge. I ran t2 for 14 hours and p2 for 16 hours. To me it probably would have been worth $11.20 to just have the one instance to manage and it would have saved on other costs.
  • The elastic IP will add about $6 to your bill
  • Don’t start and stop your instance unnecessarily (but don’t forget to turn it off when you aren’t using it)
  • Some of the simpler examples like mnist are pretty reasonable on a laptop or desktop CPU, play with that to explore the layers and different model features if you can.
3 Likes

Oh and yes, IT IS WORTH IT! @jeremy and @rachel are brilliant and sharing practical real world experience and knowledge. They community here is awesome and so helpful. If you want to learn about this field which is shaping our world and future, then this is the place to do it!

2 Likes

If you really want to slash your costs on AWS, consider spinning up spot instances as shown in this thread. I’ve been paying $0.15-0.20 per hour instead of $0.90 for on-demand instances. You can also dispense with the elastic IP if you find you don’t need it and want to pay less.

Also note that you’ll need to use a different AMI when setting up your EC2 instance with a smaller EBS size. If you do a search in this forum you should be able to find some more info on the topic.

1 Like

Thanks for the nice words! :slight_smile:

Awesome tips! I was wondering the same (how to reduce server cost). I’ve just started the Lesson 1 homework and keeping a close eye on my server time. Only $7 CAD so far.

Still would have been nice to know these settings before setting things up, perhaps these tips can be added to the wiki to new comers.

At the bottom of the page http://course.fast.ai/lessons/aws.html
the URL of “this link” is
https://us-west-2.console.aws.amazon.com/ec2/v2/home?region=us-west-2#Limits:

I would suggest that a note be added that, since we have an international audience,
that each select the appropriate AWS region at the upper right corner of the AWS screen.

Hi I am not able to connect to jupyter notebook using the instanceURL:8888.

getting ERR_CONNECTION_TIMED_OUT.

Jupyter notebook is running successfully on the instance.

[I 16:30:10.813 NotebookApp] [nb_conda_kernels] enabled, 2 kernels found
[W 16:30:11.168 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 16:30:11.202 NotebookApp] ✓ nbpresent HTML export ENABLED
[W 16:30:11.202 NotebookApp] ✗ nbpresent PDF export DISABLED: No module named nbbrowserpdf.exporters.pdf
[I 16:30:11.204 NotebookApp] [nb_conda] enabled
[I 16:30:11.234 NotebookApp] [nb_anacondacloud] enabled
[I 16:30:11.237 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 16:30:11.237 NotebookApp] 0 active kernels
[I 16:30:11.237 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/
[I 16:30:11.237 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

Help?

Interesting…it seems like it was a firewall issue.

Using my cellphone, it worked.

Hi I am a little lost when it comes to setting up AWS. I have been following the video but seems like a lot of things on AWS have changed. I would recommend an update to the video since that would solve a lot of people’s problems in one shot.

My specific problem:
I get up to the point where in cygwin I write the command ‘bash setup_p2.sh’. I get this error:
: No such file or directory/bash
setup_p2.sh: line 4: $’\r’: command not found
setup_p2.sh: line 9: syntax error near unexpected token elif' 'etup_p2.sh: line 9:elif [ $region = “eu-west-1” ]; then

Should I be starting the amazon instance manually? I am not sure how to do that… I requested the limit increase which got approved but haven’t done anything on the AWS website manually. Not sure if that is correct.

Hi @tehskhu,

Once it works, the script should start the EC2 instance for you, at which point you can SSH in.

You may be able to resolve your problem by running the dos2unix utility on the script.

I tried this but got similar error:
$ dos2unix setup_p2_old.sh
-bash: dos2unix: command not found

Can you be a bit more specific?

You can install it using the Cygwin package manager.

Alternatively, you may be able to remove the carriage returns by executing the following command:

sed -i 's/\r$//' setup_p2.sh

Let me know if that works out.

I am almost there. Can start the instance. However when I do nvidia-smi I get the error:
nvidia-smi: command not found
How to fix this?

Jupyter notebook runs
There is no message returned when I try to import theanos
import keras says using theano backend so I think this is ok.

Also another question. If I release my elastic IP, will I automatically be assigned a public IP? From my understanding, I just have to make sure I know which IP I get assigned everytime and use that when to connect. Is that correct or are there any other steps involved?

Try rebooting your instance to resolve the nvidia-smi issue.

If you don’t want to use an EIP, make sure that your subnet automatically assigns a public IP to your instance on launch - i.e., the following checkbox should be checked:

Or if you prefer the cli:

aws ec2 modify-subnet-attribute --subnet-id <your-subnet-id> --map-public-ip-on-launch

Note that, as far as I know, a public IP is only assigned at launch - you can’t attach a public IP to a pre-existing EC2 instance (but you could still attach another EIP).

im connecting to my P2 Ec2 instance using ssh and having intermitted connection. (i.e i lose my ssh connection every 30 mins). Was wondering if anyone has had similar problems and how you solved it?

Thanks.

I am trying to run: bash setup_p2.sh, but encountered the following error:

An error occurred (OptInRequired) when calling the CreateVpc operation: You are not subscribed to this service. Please go to http://aws.amazon.com to subscribe.

But I have configured aws using the generated credential. Anyone can help? Many thanks!

hi!
could you give me the method with more details?
please,