How to set the beanstalk .ebextensions .config “sources” key “target directory” to the current bundle directory

amazon-web-serviceselastic-beanstalk

I'm working in a python 2.7 elastic beanstalk environment.

I'm trying to use the sources key in an .ebextensions .config file to copy a tgz archive to a directory in my application root — /opt/python/current/app/utility. I'm doing this because the files in this folder are too big to include in my github repository.

However, it looks like the sources key is executed before the ondeck symbolic link is created to the current bundle directory so I can't reference /opt/python/ondeck/app when using the sources command because it creates the folder and then beanstalk errors out when trying to create the ondeck symbolic link.

Here are copies of the .ebextensions/utility.config files I have tried:

sources:
  /opt/python/ondeck/app/utility: http://[bucket].s3.amazonaws.com/utility.tgz

Above successfully copies to /opt/python/ondec/app/utility but then beanstalk errors out becasue it can't create the symbolic link from /opt/python/bundle/x –> /opt/python/ondeck.

sources:
  utility: http://[bucket].s3.amazonaws.com/utility.tgz

Above copies the folder to /utility right off the root in parallel with /etc.

Best Answer

I was able to accomplish this with a different key:

container_commands:
  001_get_utility_dir:
    command: "cd /opt/python/ondeck/app/utility && curl http://[bucket].s3.amazonaws.com/elasticbeanstalk/utility.tgz | tar xz"