Search code examples
amazon-elastic-beanstalkebextensionsamazon-linux-2

How do you run container commands on ElasticBeanstalk / Amazon Linux 2?


I currently have a Laravel application running on ElasticBeanstalk with the following file running a deployment command for me...

.ebextensions/deployment-commands.config

container_commands:
    01-run-migrations:
        command: "php artisan migrate --force"
        cwd: "/var/app/ondeck"
        leader_only: true

I'm trying to update my PHP version to 7.4 so I need to upgrade to an Amazon Linux 2 server. This command doesn't seem to work on the new Amazon Linux 2 setup so I'm wondering if it will pickup ebextensions anymore and if so do I need to change the cwd? Basically what do I need to do to get this deployment command to work?


Solution

  • I'm trying to update my PHP version to 7.4 so I need to upgrade to an Amazon Linux 2 server.

    Not sure what do you mean here, but upgrading from Amazon Linux 1 (AL1) to AL2 may require many more changes then just upgrading php:

    container_commands run in staging folder /var/app/staging. But you are trying to use different folder /var/app/ondeck which may be why you don't see the commands effects.