Install and Start httpd in AWS Launch Configuration












0















I'm trying to make a Launch Configuration for my AWS Cloud Environment.



I wan't to install httpd and start it up on the fly, when the autoscaling group spins up a new EC2 instance.



I can SSH into the instance manually and install httpd with:
sudo yum update -y
sudo yum install httpd -y
sudo service httpd start



But I can't make it happen, with the Launch Configuration under Advance Details -> User Data
sudo yum update -y
sudo yum install httpd -y
sudo service httpd start



Any ideas why it's not the same?



enter image description here



Update
After adding #!/bin/bash as @Mark-B suggested, then service is kindda installed. It gives the following error when restarting the service. Maybe it could be a hint for you, to figure out what is wrong?



enter image description here










share|improve this question





























    0















    I'm trying to make a Launch Configuration for my AWS Cloud Environment.



    I wan't to install httpd and start it up on the fly, when the autoscaling group spins up a new EC2 instance.



    I can SSH into the instance manually and install httpd with:
    sudo yum update -y
    sudo yum install httpd -y
    sudo service httpd start



    But I can't make it happen, with the Launch Configuration under Advance Details -> User Data
    sudo yum update -y
    sudo yum install httpd -y
    sudo service httpd start



    Any ideas why it's not the same?



    enter image description here



    Update
    After adding #!/bin/bash as @Mark-B suggested, then service is kindda installed. It gives the following error when restarting the service. Maybe it could be a hint for you, to figure out what is wrong?



    enter image description here










    share|improve this question



























      0












      0








      0








      I'm trying to make a Launch Configuration for my AWS Cloud Environment.



      I wan't to install httpd and start it up on the fly, when the autoscaling group spins up a new EC2 instance.



      I can SSH into the instance manually and install httpd with:
      sudo yum update -y
      sudo yum install httpd -y
      sudo service httpd start



      But I can't make it happen, with the Launch Configuration under Advance Details -> User Data
      sudo yum update -y
      sudo yum install httpd -y
      sudo service httpd start



      Any ideas why it's not the same?



      enter image description here



      Update
      After adding #!/bin/bash as @Mark-B suggested, then service is kindda installed. It gives the following error when restarting the service. Maybe it could be a hint for you, to figure out what is wrong?



      enter image description here










      share|improve this question
















      I'm trying to make a Launch Configuration for my AWS Cloud Environment.



      I wan't to install httpd and start it up on the fly, when the autoscaling group spins up a new EC2 instance.



      I can SSH into the instance manually and install httpd with:
      sudo yum update -y
      sudo yum install httpd -y
      sudo service httpd start



      But I can't make it happen, with the Launch Configuration under Advance Details -> User Data
      sudo yum update -y
      sudo yum install httpd -y
      sudo service httpd start



      Any ideas why it's not the same?



      enter image description here



      Update
      After adding #!/bin/bash as @Mark-B suggested, then service is kindda installed. It gives the following error when restarting the service. Maybe it could be a hint for you, to figure out what is wrong?



      enter image description here







      amazon-web-services amazon-ec2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 16:29







      RedHawkDK

















      asked Nov 23 '18 at 15:57









      RedHawkDKRedHawkDK

      6028




      6028
























          1 Answer
          1






          active

          oldest

          votes


















          2














          User-data can be used for more than running startup scripts. To indicate to the cloud-init process that the user-data is a script, you need to add this as the first line of your user-data:



          #!/bin/bash






          share|improve this answer
























          • Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

            – RedHawkDK
            Nov 23 '18 at 16:18













          • @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

            – Mark B
            Nov 23 '18 at 19:50











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449702%2finstall-and-start-httpd-in-aws-launch-configuration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          User-data can be used for more than running startup scripts. To indicate to the cloud-init process that the user-data is a script, you need to add this as the first line of your user-data:



          #!/bin/bash






          share|improve this answer
























          • Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

            – RedHawkDK
            Nov 23 '18 at 16:18













          • @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

            – Mark B
            Nov 23 '18 at 19:50
















          2














          User-data can be used for more than running startup scripts. To indicate to the cloud-init process that the user-data is a script, you need to add this as the first line of your user-data:



          #!/bin/bash






          share|improve this answer
























          • Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

            – RedHawkDK
            Nov 23 '18 at 16:18













          • @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

            – Mark B
            Nov 23 '18 at 19:50














          2












          2








          2







          User-data can be used for more than running startup scripts. To indicate to the cloud-init process that the user-data is a script, you need to add this as the first line of your user-data:



          #!/bin/bash






          share|improve this answer













          User-data can be used for more than running startup scripts. To indicate to the cloud-init process that the user-data is a script, you need to add this as the first line of your user-data:



          #!/bin/bash







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 23 '18 at 16:03









          Mark BMark B

          100k15157172




          100k15157172













          • Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

            – RedHawkDK
            Nov 23 '18 at 16:18













          • @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

            – Mark B
            Nov 23 '18 at 19:50



















          • Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

            – RedHawkDK
            Nov 23 '18 at 16:18













          • @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

            – Mark B
            Nov 23 '18 at 19:50

















          Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

          – RedHawkDK
          Nov 23 '18 at 16:18







          Hi Mark. That makes sense! Thanks. Any ideas, why the server still isn't starting up the same way, as when I start it up manually? sudo service httpd status --- > httpd (pid 2734) is running... so it apparently looks fine...

          – RedHawkDK
          Nov 23 '18 at 16:18















          @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

          – Mark B
          Nov 23 '18 at 19:50





          @RedHawkDK that second issue looks like a duplicate of this: stackoverflow.com/questions/5856205/…

          – Mark B
          Nov 23 '18 at 19:50


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53449702%2finstall-and-start-httpd-in-aws-launch-configuration%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Berounka

          Sphinx de Gizeh

          Different font size/position of beamer's navigation symbols template's content depending on regular/plain...