DEV Community

Discussion on: How to automate creating high end virtual machines on AWS for data science projects

Collapse
 
melezhik profile image
Alexey Melezhik • Edited

Hi! Thank for your post. You may try Sparrowform as provision tool, this might some reduce Bash complexity and let you run provision independently on Terraform:

So instead of provisioner "remote-exec" ... inside your terrafrom scenario just ( scenario for CentOS7 ):

$ cat aws_instance.Node.sparrowfile

for (
    'git', 'vim-enhanced.x86_64',
    'python36u', 'python36u-pip', 'python36u-devel'
  ) -> $p {
  package-install $p
}

bash "pip3.6 install jupyter";

my $user = input_params('SshUser');

directory "/home/$user/.jupyter", %( owner => $user );


file "/home/$user/.jupyter/jupyter_notebook_config.py", %(
  owner    => $user,
  content  => "c.NotebookApp.allow_origin = '*'
c.NotebookApp.ip = '0.0.0.0'"
)

And then:

$ terraform apply
$ sparrowform --ssh_user=centos --ssh_private_key=~/Downloads/alexey-test.pem