Search code examples
herokuaws-cli

Install AWS CLI on heroku


I would like to use the AWS CLI in an Heroku Ruby project (mainly to use it with a thin wrapper from the ruby application).

Is there any standard way to install additional software like this into an existing application with a Gemfile?


Solution

  • Here are the steps that worked for me:

    1) use buildpack-multi to install buildpacks both for ruby and python:

    heroku config:add BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
    echo "https://github.com/heroku/heroku-buildpack-ruby" >> .buildpacks    
    echo "https://github.com/heroku/heroku-buildpack-python" >> .buildpacks
    echo "web: bundle exec rails server -p $PORT" > Procfile
    

    2) add a requirements.txt file to the root of the project, containing the desired pip package:

    echo "awscli" >> requirements.txt
    

    3) deploy to Heroku

    git add .buildpacks requirements.txt Procfile
    git commit -a -m "use buildpacks for ruby and python, install aws cli"
    git push heroku   
    

    This works just fine and allows me to use my aws scripts from my ruby app. As was pointed out to me, using fog is probably the better solution in the long term.