Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brentley/db0136677e0a85ef4e288d35248d0615 to your computer and use it in GitHub Desktop.
Save brentley/db0136677e0a85ef4e288d35248d0615 to your computer and use it in GitHub Desktop.
1) First, make sure you local machine has EB CLI, for Mac, simple do brew install awsebcli
2) Create new AWS credentials, add it to your local machine like so
open or create the file:
~/.aws/credentials
add the following in this new file:
[my_project]
aws_access_key_id=*****
aws_secret_access_key=*****
3) Initialize elastic beanstalk from your project root:
eb init --profile my_project
*note: the string following the "--profile" flag should match the string inside [] for your awe credentials,
the CLI auto loads the key and secret from your local machine. If you don't specify the profile, you might get an access error.
4) Deploy your project
run eb create
you will be prompted to enter an environment name for the git branch you are currently on. Elastic Beanstalk uses git based deploys,
it assumes each git branch has a seperate environment
5) After the first deploy, the application will not work because the env variables are not set and the document root is not correct.
To correct this, go to the AWS web console and click the Elastic Beanstalk Service
On the left hand menu go to "Configuration"
On the "Software Configuration" tab, click the gear icon.
Since this is a craft project, set the "Document root" to "/public", it would be "/site" for Drupal, or simply "/" for wordpress.
Near the bottom of the page, add the same configs in your .env file (DB_HOST, DB_USER, etc)
Once the configs finish updating, your app should be up and running.
6) The above steps only have to be done one time per local machine. For subsequence deploys, simply run:
eb deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment