How to run userdata scripts on Custom FreeBSD AMI?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I read that you can only run userdata once on an EC2 AMI. If you make a custom AMI from an EC2 instance, you cannot run userdata script on that custom AMI. On Ubuntu instances, you can remove /var/lib/cloud/* , make a custom AMI and run userdata on the custom AMI. I cannot find an equivalent of /var/lib/cloud/* on FreeBSD.



Is there a way to run userdata on custom FreeBSD AMI or an alternative to create an AMI so that you can run userdata scripts again?



There is #cloud-boothook for Linux but for FreeBSD, I only found configinit which doesn't do what I need. We pass arguments into the userdata scripts from the command line while launching instances.







share|improve this question


























    up vote
    0
    down vote

    favorite












    I read that you can only run userdata once on an EC2 AMI. If you make a custom AMI from an EC2 instance, you cannot run userdata script on that custom AMI. On Ubuntu instances, you can remove /var/lib/cloud/* , make a custom AMI and run userdata on the custom AMI. I cannot find an equivalent of /var/lib/cloud/* on FreeBSD.



    Is there a way to run userdata on custom FreeBSD AMI or an alternative to create an AMI so that you can run userdata scripts again?



    There is #cloud-boothook for Linux but for FreeBSD, I only found configinit which doesn't do what I need. We pass arguments into the userdata scripts from the command line while launching instances.







    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I read that you can only run userdata once on an EC2 AMI. If you make a custom AMI from an EC2 instance, you cannot run userdata script on that custom AMI. On Ubuntu instances, you can remove /var/lib/cloud/* , make a custom AMI and run userdata on the custom AMI. I cannot find an equivalent of /var/lib/cloud/* on FreeBSD.



      Is there a way to run userdata on custom FreeBSD AMI or an alternative to create an AMI so that you can run userdata scripts again?



      There is #cloud-boothook for Linux but for FreeBSD, I only found configinit which doesn't do what I need. We pass arguments into the userdata scripts from the command line while launching instances.







      share|improve this question














      I read that you can only run userdata once on an EC2 AMI. If you make a custom AMI from an EC2 instance, you cannot run userdata script on that custom AMI. On Ubuntu instances, you can remove /var/lib/cloud/* , make a custom AMI and run userdata on the custom AMI. I cannot find an equivalent of /var/lib/cloud/* on FreeBSD.



      Is there a way to run userdata on custom FreeBSD AMI or an alternative to create an AMI so that you can run userdata scripts again?



      There is #cloud-boothook for Linux but for FreeBSD, I only found configinit which doesn't do what I need. We pass arguments into the userdata scripts from the command line while launching instances.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 23:41

























      asked Mar 25 at 14:34









      pdns

      656




      656




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          The FreeBSD AMI on AWS does not provide the same level of support for user_data scripts as other AMIs. As you pointed out, it does not support #cloud-boothook user_data and ignores any user_data passed after boot.



          A simple solution is the following:



          sed -i '' '/KEYWORD: *firstboot$/d' /usr/local/etc/rc.d/ec2_configinit


          This is a hack -- your instance will now execute all user_data scripts, even those without the #cloud-boothook tag, but in my opinion it is much better than the default behavior of the script. Note that one can always disable the ec2_configinit script altogether by turning it off in /etc/rc.conf.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );








             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433426%2fhow-to-run-userdata-scripts-on-custom-freebsd-ami%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            The FreeBSD AMI on AWS does not provide the same level of support for user_data scripts as other AMIs. As you pointed out, it does not support #cloud-boothook user_data and ignores any user_data passed after boot.



            A simple solution is the following:



            sed -i '' '/KEYWORD: *firstboot$/d' /usr/local/etc/rc.d/ec2_configinit


            This is a hack -- your instance will now execute all user_data scripts, even those without the #cloud-boothook tag, but in my opinion it is much better than the default behavior of the script. Note that one can always disable the ec2_configinit script altogether by turning it off in /etc/rc.conf.






            share|improve this answer
























              up vote
              1
              down vote



              accepted










              The FreeBSD AMI on AWS does not provide the same level of support for user_data scripts as other AMIs. As you pointed out, it does not support #cloud-boothook user_data and ignores any user_data passed after boot.



              A simple solution is the following:



              sed -i '' '/KEYWORD: *firstboot$/d' /usr/local/etc/rc.d/ec2_configinit


              This is a hack -- your instance will now execute all user_data scripts, even those without the #cloud-boothook tag, but in my opinion it is much better than the default behavior of the script. Note that one can always disable the ec2_configinit script altogether by turning it off in /etc/rc.conf.






              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                The FreeBSD AMI on AWS does not provide the same level of support for user_data scripts as other AMIs. As you pointed out, it does not support #cloud-boothook user_data and ignores any user_data passed after boot.



                A simple solution is the following:



                sed -i '' '/KEYWORD: *firstboot$/d' /usr/local/etc/rc.d/ec2_configinit


                This is a hack -- your instance will now execute all user_data scripts, even those without the #cloud-boothook tag, but in my opinion it is much better than the default behavior of the script. Note that one can always disable the ec2_configinit script altogether by turning it off in /etc/rc.conf.






                share|improve this answer












                The FreeBSD AMI on AWS does not provide the same level of support for user_data scripts as other AMIs. As you pointed out, it does not support #cloud-boothook user_data and ignores any user_data passed after boot.



                A simple solution is the following:



                sed -i '' '/KEYWORD: *firstboot$/d' /usr/local/etc/rc.d/ec2_configinit


                This is a hack -- your instance will now execute all user_data scripts, even those without the #cloud-boothook tag, but in my opinion it is much better than the default behavior of the script. Note that one can always disable the ec2_configinit script altogether by turning it off in /etc/rc.conf.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Aug 1 at 4:37









                jornada

                261




                261






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433426%2fhow-to-run-userdata-scripts-on-custom-freebsd-ami%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Peggy Mitchell

                    Palaiologos

                    The Forum (Inglewood, California)