The Elastic Beanstalk on Amazon Web Services is a service used to deploy your application to the cloud. Amazon then handles all of the provisioning of instances, loading assets on S3, configuring load balancers and running your server software such as IIS. Configuring what happens when you deploy using Elastic Beanstalk is fairly straightforward, and for more in-depth commands an Elastic Beanstalk Configuration File can be deployed with the application. The configuration file is YAML-based, and can be used to download and install MSIs and other packages and also run commands on the instance. You can read more about them here.
I found the other day that I needed specific commands to run only once, when the application is first deployed to the server. Luckily I found this StackOverflow question:
Which explains that, to run commands only once, a
test: modifier can be added to the command. This modifier will run a command that returns a True or False value, which then determines whether to proceed with the actual command. Below is the example provided in the StackOverflow question:
commands: 01-do-always: command: run_my_script 02-do-on-boot: command: script_to_run_once test: test ! -f .semaphore 99-signal-startup-complete: command: touch .semaphore
This worked great, and I was able to run the commands only once, and the config files in general are extremely useful!