AWS provides an “officially unsupported” set of scripts for Windows, OSX, and Linux that will help with managing and deploying your AWS Elastic Beanstalk applications. This can be useful as I could not find a simple way to SSH into my ELB-based EC2 instance using standard methodologies. I’m sure I missed something but deploying and updating via git commands is going to be easier and my preferred production method; might as well go there now.
Download and install AWS Elastic Beanstalk Command Line Tool.
Unzip the file.
You will now have a directory that contains three types of command sets. In the appropriately-named eb subdirectory is a series of OS command-line scripts via “eb” commands. In the api directory is a full-fledged ruby-based implementation of very long command names that require ruby, ruby-developer, and the JSON gem to function. In AWSDevTools is and extension of git commands that add new AWS-specific scripts to the git command.
Activating “eb” Command Line
Edit your OS PATH variable to point to your unzipped download directory. I changed my unzipped directory to be something shorter and put it in my Linux root directory. To activate the eb command:
Add the path to the proper Linux Python directory (I am running 2.7.X). My CentOS .bash_profile:
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
# User specific environment and startup programs
Save and reload .bash_profile into my current environment (next time you log out / in this will not be necessary… and yes, dot-space-dot is correct):
# . .bash_profile
Activating Extended Command Line
The “extended” command line are the ruby-based scripts that give you some very long command names that do a lot of different things.
First make sure ruby , ruby-develop, and the JSON gems are installed. For CentOS:
# yum install ruby ruby-develop
# gem install json
Go create an AWS credentials file.
I put mine in my .ssh directory. It looks like this (use your key IDs):
Read the article on Deploying WordPress 4.2.2 On Elastic Beanstalk, Part 1 and setup a unique IAM account for this. Using your main AWS login credential is not recommended. If they get compromised… well… just don’t do that.
Then edit your PATH using the same methodology as noted above.
This time adding the api directory to your path:
OK, now add this to your current running Linux environment:
# . .bash_profile
It will likely come back with “no applications found”.
Setup git Tools For AWS
Yup, same idea as above. Edit your path file to include the git tool kit, but a slight twist here. Once you do that you will need to run the setup command noted below in each repository where you want AWS tools.
Edit your PATH and invoke it the double-dot-bash-trick noted above.
New tricks… go set this up in your project directory.
Your project directory is where your WordPress PHP application resides and you’ve create a git repository to manage it. You’ve already done your git init and committed stuff to the repository. Dig around this site or the Internet to find out how to do that if you’re not sure. Again, I recommend the Deploying WordPress 4.2.2 On Elastic Beanstalk, Part 1 article as it has some special Elastic Beanstalk config files in it that will be used by ELB to connect RDS dynamically and set your WP Salt values.
For this to work you are going to need to have Python (same with “eb” above) and the Python Boto library installed. I
If you don’t have boto yet, you install it on CentOS with:
# sudo yum install python-boto
Assuming you already have your WordPress stuff in a git repo, go to that directory.
In my case /var/www/html holds my WordPress install that has been put into a git repo.
# cd /var/www/wpslp/
Now setup the git extensions using this command:
If everything is setup correctly you can check the git commands with something like:
# git aws.push
It will likely come back with an “Updating the AWS Elastic Beanstalk environment None…” message.
Either that or it will update the entire Internet , or at least the Amazon store, with your WordPress code.
Combined with your ELB Environment you setup from the previous article on the subject, your are ready to go conquer the world with your new git-deployed WordPress installation on ELB.
You can learn more about setting up the AWS-specific git parameters and how to use git with AWS and this tookit on at this .git Develop, Test, and Deploy article.
Next I will figure out how to marry the two and will share my crib notes here.