Assignment configuring a website using Elastic Beanstalk, Python Flask, and MySQL
- The main python application file should be named application.py.
- The flask object name, defined in application.py should also be called application.
- Each route in your application should also contain the method. Probably GET and/or POST
- .ebignore contains the name of files we don't want pushed to the cloud.
- Use pip freeze > requirements.txt to create a requirements.txt file.
- Create a folder named .ebextensions which should contain:
- A file named python.config that contains the commands to execute your application.
- A file named environment_variables.config that contains any necessary environment variables.
- Zip .ebextensions, static, templates, .ebignore, application.py, requirements.txt
- These six files should be at the root of the zip file. Not in a folder.
- If you are using a Mac to zip your files, remove any extra, hidden files in the zip or you will get errors
zip -d flask_app.zip __MACOSX/\*
Create a MySQL with public access. Put it in the default VPC.
Your IP address should be able to connect on port 3306.
Install MySQL Workbench and connect to your database.
Populate MySQL.
Edit .ebextensions/environment_variables.config to set database username, password, and hostname. Zip the 6 items necessary for the application - .ebextensions, static, templates, .ebignore, application.py, requirements.txt
Upload the zip file.
Modify security groups.
Visit the environment URL to prove the application works.
Figure out how to connect your domain to an EB application.
- https://medium.com/quick-code/setting-up-godaddy-domain-and-aws-route-53-with-elastic-beanstalk-within-15-minutes-a0276ff4ea6e
- https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-to-beanstalk-environment.html
Figure out how to set up a CodeDeploy Pipeline for an EB application.