You need to wait for cloud-init to finish, see https://www.digitalocean.com/community/questions/how-to-make-sure-that-cloud-init-finished-running
Cloud-init is best suited for setting up access related things (which might be impossible with a provisioner). Cloud-init only reports errors to a log file and doesn't abort the image creation. / Rickard On Oct 14, 2017 00:12, "Kevin Johnson" <[email protected]> wrote: > I came to understand based on this: https://github.com/ > hashicorp/packer/issues/1731 that Packe works with provisioners at the > first opportunity it has ssh available. It will pass the #boot-config > script which runs at boot time, but by the time Packer finally has SSH > access to the instance, it dives in and find that there is nothing to > execute as there is no shell provisioner and thus abruptly ends the > instance, not caring whether or not the #boot_config script is completed. I > guess #boot_config is more suitable for the packages section and critical > stuff at boot time, but to use it for creating directories, downloading > files etc is not a good way of using Packer. > > Issue resolved, thanks. > > On Friday, October 13, 2017 at 5:06:07 PM UTC-4, Kevin Johnson wrote: >> >> Hi, >> >> I just started using Packer for the first time >> >> I want to use it to create a custom AMI based on Amazon Linux AMI for >> ElasticBeanstalk. >> I want to use the base image and install erlang, elixir and Rserve on it. >> For this purpose, I wrote a #cloud-config script to declare all the >> dependencies under "packages:", and to declare all the instructions it >> needs to execute, under "runcmd:", >> so that packer during the build will download a 250mb file from >> erlang.com/download, download a git repo for elixir and download R and >> all its dependencies >> >> I have tested the #cloud-config script by launching an ec2 instance and >> supplying it as user-data. Once I had it fully working, I proceeded to >> supplement this script to packer by specifying a user_data_file >> >> The problem that I am experiencing is that packer stops the instance too >> soon for my 250MB file to even get downloaded. The server only stays on for >> like 20-30 seconds and then it abruptly ends it. >> >> Can someone explain to me why Packer is behaving in this way and what >> potential workaround I may consider? >> >> Thanks in advance. >> > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/mitchellh/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/packer-tool/097400a4-2f53-4c15-9327-0637d2b7631d%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/097400a4-2f53-4c15-9327-0637d2b7631d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/mitchellh/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt_rFaNWqb%2BKc2v_yPFYxahJe1_BPOMkppY6VGrrJnwStA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
