title: How to install and enable a service in amazon Elastic Beanstalk?
body: <p>I'm banging my head against a wall trying to both install and then enable a service in elastic beanstalk.  What I want to do is:</p>
  
  <ol>
  <li><p>Install a service in <code>/etc/init.d</code> that points to my python app in <code>/opt/python/current/app/</code></p></li>
  <li><p>Have Elastic Beanstalk start and keep-alive the service, as specified in an <code>.ebextensions/myapp.config</code> file. </p></li>
  </ol>
  
  <p>(Reference: <a href="http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-services" rel="noreferrer">http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-services</a>)</p>
  
  <p>Here's my <code>.ebextensions/myapp.config</code> file:</p>
  
  <pre><code>container_commands:
    01_copy_service:
      command: "cp /opt/python/ondeck/app/my_service /etc/init.d/"
    02_chmod_service:
      command: "chmod +x /etc/init.d/my_service"
  
  services:
    sysvinit:
      my_service:
        enabled: true
        ensureRunning: true
        files : [/etc/init.d/my_service]
  </code></pre>
  
  <p>This fails because services are run before container_commands.  If I comment out services, deploy, then uncomment services, then deploy again, it will work.  But I want to have a single-step deploy, because this will be an auto-scaling node.</p>
  
  <p>Is there a solution?  Thanks!</p>