Docs
I'm trying to pass multiple commands in a conainter_commands
entry and keep getting errors. Yet when I pass the same commands as individual entries it works fine.
Works:
container_commands:
01_remove_old_dump:
command: 'rm -f /tmp/db.dump'
02_get_new_dump:
command: 'aws s3 cp s3://bucket/db.dump'
Fails with /bin/sh: rm -f /tmp/db.dump: No such file or directory.
container_commands:
01_remove_old_dump:
command: ('rm -f /tmp/db.dump' 'aws s3 cp s3://bucket/db.dump')
ebextensions). Configuration files are YAML formatted documents with a . config file extension that you place in a folder named . ebextensions and deploy in your application source bundle. EB configuration files are so powerful that you don't have to connect to your instance through SSH to issue configuration commands.
You can tail some logs in the web UI to see whether your . ebextensions worked (via Elastic Beanstalk → view an environment → Logs). You should see a success or fail message for each command you define. (For example, for a command named 01_setup you'll see a message like command 01_setup succeeded .)
ebextensions, see the Elastic Beanstalk Configuration Files Repository . Location – Place all of your configuration files in a single folder, named . ebextensions , in the root of your source bundle.
Never mind, I just broke the lines up with a YAML block and that works:
01_command:
command: |
if [[ ! $ENVIRONMENT = "PROD" ]] && [[ $RDS_HOSTNAME ]]
rm -f /tmp/db.dump
aws s3 cp s3://bucket/db.dump
pg_restore -H $RDS_HOSTNAME dbname /tmp/db.dump
echo "Refreshing database..."
else
Echo "Environment is ${ENVIRONMENT}. Skipping database refresh..."
fi
NOTE: Removed this, it doesn't seem to work (always returns true):
test: |
[[ ! $ENVIRONMENT = "PRODUCTION" ]] && \
[[ $RDS_HOSTNAME ]] && \
echo "Refreshing database..."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With