gotto directory and eb init and select all of the configs
at this point an elasticbeanstalk directory is in the project directory. We need to change the deployment from the directory files to the zip file. This is done by going into the config.yml file (which is in the elasticbeanstalk directory) and adding that directive
This is what mine looked like with the addition of the deploy / artifact
branch-defaults: default: environment: null deploy: artifact: GitRepoApp.zip global: application_name: GitRepoApp default_ec2_keyname:
default_platform: PHP 7.0 default_region: us-east-1 profile: eb-cli sc: null
The next thing that needs to be done is compressing your files and creating the zip file that will be deployed. If you are on a Mac the best way to do this is to run the zip command from the command line (terminal). Navigate to the directory that contains your files (use cd commands inside of terminal). Once in you directory issue the command: zip -r nameofzipfile.zip .
Don't forget to include the ending space and period. This will include the hidden elasticbeanstalk and (soon to follow) ebextensions folder.
zip -r BA-Multi.zip .
(Option you may want to use zip -FSr BA-Multi.zip so that it will overwrite the zip file if it isn't deleted after each use Option 2: you will probably also want to remove git and git repo files from the zip file. That command is
zip -FSr BA-Multi.zip . -x *.git*
now that we have a working zip file it is time to create and deploy our app.
eb create will deploy your application the first time. You can log into AWS into the elastic beanstalk all applications and see your app deploying. It will give you the status updates along with the health and event log. This will also be updating in terminal as well - however the aws elastic beanstalk dash will give more info
IF for some reason your deployment failed (bad files or something else) you don't have to issue the eb create command. Instead you will issue eb deploy. This will reupload the zip and deploy the server with the new app.
If your application launched you should now have an ec2 unit that can be ssh'd into. This is helpful if you need to check for file/app integrity or you need to make sure your ebextensions have issued the commands they need to. To ssh into the server first find the path to the server. You can do that by going into your AWS account and clicking on EC2 Dashboard. Under running instances an ec2 unit with the name of your app should be running. Click on it and look for the information under public DNS. Copy that sting - it should look like this
to ssh into that instance you will issue the command:
ssh -i /pathtoyour/sshkey/ssh.pem firstname.lastname@example.org
at this point you can check the server, navigate directories and ensure that the ec2 deployed by beanstalk is doing what it should. One area of the server you will probably be interested in is cd /var/app/current/ This directory holds all of the files that were contained in your zip file. Of course at this point they are no longer in a zip file; they have been unzipped and dumped into this directory.
When you are finished with your deployment you can do a few things. You could technically stop the ec2 unit - or you could go into the elasticbeanstalk dash and stop the app from there. Another option is to issue the command
eb terminate GitRepoAppThis will stop all the services associated with this running app.