In the end, I over-complicated this and misunderstood the process.
My goal was to create a directory on my application server, which was hosted in Elastic Beanstalk. Although I wanted to create the directory on the server, the commands I was using in my config.yml file were creating the directory in the container. CircleCI behaved perfectly fine. I didn’t!
Instead, I simply needed to add the command to the config file located in my .ebextensions source folder.
Here’s the full config file from the .ebextensions folder, for anyone else who runs across this.
"/root/.ssh/config":
owner: root
group: root
mode: "000600"
content: |
Host github.com
User git
Hostname github.com
IdentityFile /root/.ssh/battlestardigitalbot-github-deploy
"/root/.ssh/known_hosts":
owner: root
group: root
mode: "000644"
content: |
[REDACTED]
commands:
01-command:
command: sudo aws s3 cp s3://battlestar-deployment-key/battlestardigitalbot-github-deploy /root/.ssh
02-command:
command: sudo chmod 600 /root/.ssh/battlestardigitalbot-github-deploy
03-command:
command: sudo mkdir -m 0755 -p /var/user_image