Up until now I've basically used spot instances as cheaper on-demand instances, but the changes made since last November make it harder to predict interruption (and thus choose instances that won't get interrupted), so I'm trying to figure out how to use spot instances in the way they they are intended to be used.
Luckily, my jobs are quite fault-tolerant -- this one is large-scale geoprocessing. My problem is getting by startup shell script to work. I'm not sure if it is an issue with the shell script itself, an issue with how I'm interfacing with AWS, or some other issue.
Here is my bash script:
#!/bin/bash
# make a directory
mkdir /home/ubuntu/MACA
# attach the EBS volume that has all of my data and scripts
aws ec2 attach-volume --volume-id vol-6969420420 --instance-id $(curl http://169.254.169.254/latest/meta-data/instance-id) --device /dev/xvdf
# mount it
mount /dev/xvdf /home/ubuntu/MACA
# remove cruft left over from interrupted runs
rm /home/ubuntu/MACA/tmp/+macav2metdata_*
# run my R script that implements my job
Rscript --verbose /home/ubuntu/MACA/tmp/process_maca_v2.r
I don't do a lot of shell scripting -- is something amiss here? I tell AWS to run it via the console:
When I go and SSH in, nothing is happening. Here is the relevant part of the /var/log/cloud-init-output.log
:
Cloud-init v. 17.1 running 'modules:config' at Wed, 14 Feb 2018 22:38:25 +0000. Up 40.96 seconds.
Cloud-init v. 17.1 running 'modules:final' at Wed, 14 Feb 2018 22:38:32 +0000. Up 48.23 seconds.
2018-02-14 22:38:32,757 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/part-001 [-]
2018-02-14 22:38:32,859 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
2018-02-14 22:38:32,865 - util.py[WARNING]: Running module scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed
Cloud-init v. 17.1 finished at Wed, 14 Feb 2018 22:38:33 +0000. Datasource DataSourceEc2Local. Up 48.77 seconds
Some sort of python error? I don't know how to parse this. Would appreciate help getting this running. Please let me know if I haven't provided enough info.