Reputation: 39
Working on deploying a Flask application using AWS, but the Flask app relies on API secret keys that I have saved in a config.ini file on my computer. Should I be uploading that file with the keys to AWS? How should my Flask app access those keys once deployed to AWS?
Upvotes: 0
Views: 1837
Reputation: 1324
You can possibly do one of the following (Assuming that you're deploying on a Linux Based OS):
Store the keys in variables and then export them from the file: ~/.bash_profile
Save them as environment variables
You can checkout this answer to see how to access them : Access environment variables from Python
Upvotes: 1
Reputation: 3760
I have not used Flask yet but as a good practice for deployment, you should never save your API keys/credentials in plain text anywhere.
For AWS related deployments which require API keys, I would suggest you use the IAM instance roles which have the required access that your application needs.
Upvotes: 2