When manually launching EC2 instances, we can specify a "launch script" using the user data feature.

However, I can't seem to find a similar feature in AWS Beanstalk.

Is it not possible to do so?

(As a workaround, I know I can create a custom AMI containing the necessary launch-time script, but that means I have to create different custom AMI for each possible launch-time script configuration).


You can use .ebextensions (commands/container_commands) or lifecycle hooks For e.g. we use the following commands to install newrelic agent

$ cat .ebextensions/newrelic.config
        command: yum install -y http://yum.newrelic.com/pub/newrelic/el5/x86_64/newrelic-repo-5-3.noarch.rpm
        test: "[ ! -f /etc/yum.repos.d/newrelic.repo ]"

        command: yum install -y newrelic-sysmond
        test: "[ ! -f /usr/sbin/nrsysmond ]"

        command: usermod -a -G docker newrelic
        ignoreErrors: true

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.