Wai Yan Hein
Wai Yan Hein

Reputation: 14801

AWS ElasticBeanstalk configuring or running additional commands on deployment

I am working deploying a Laravel application to the AWS ElasticBeanstalk. I configured the CLI and I could deploy the application to an ElasticBeanstalk environment running the command. This is what I have done so far.

I created an ElasticBeanstalk application and an environment in it.

Then I initialised the application for deployment using "eb init" and deployed it using "eb deploy". But I would like to add some additional commands to be run during the deployment. For example, I might run "gulp build" or other commands. Where and how can I figure it? I know that there is an .elasticextension folder but that does not allow us to add custom commands to be run on deployment.

Upvotes: 3

Views: 1396

Answers (1)

Marcin
Marcin

Reputation: 238339

I know that there is an .elasticextension folder but that does not allow us to add custom commands to be run on deployment.

Not sure what do you mean that you can't run commands in .ebextensions during deployment. But the extensions are commonly used for running commands or scripts when you are deploying your app. There are special sections for that:

  • commands: You can use the commands key to execute commands on the EC2 instance. The commands run before the application and web server are set up and the application version file is extracted.

  • container_commands: You can use the container_commands key to execute commands that affect your application source code. Container commands run after the application and web server have been set up and the application version archive has been extracted, but before the application version is deployed.

There are also platform hooks on Amazon Linux 2 to further fine tune the deployment of your applications.

Finally, if all of them are not suited, you could create dedicated build step in CodePipleline for you application. The dedicated step could be used to create fully deployment version of your application for EB with minimal amount of work to do at EB instances.

Upvotes: 3

Related Questions