Yeah, this is a little geeky, but I spent way too much time figuring this out so I thought that I would share. I mostly work with Windows, but I want to do some Amazon Web Services (AWS) Scripting in Python (which I don't really know yet). The way to do it seems to be by using a package called BOTO. However, everyone online seems to write about BOTO and Python on Linux.
The first problem I had was that BOTO does not work with Python 3.x, but I didn't figure that out until I did a little digging as to why the setup script would not work with my Python installation. So, only 2.x.
The next problem was that it was not really clear how to install BOTO. It does not come in a .zip, but only in a .tar.gz format which intimidates windows folks. Have no fear, it is not *nix only, it is just packaged that way. Extract BOTO to a temp directly using 7zip or something else that can read tar.gz files. Then change into the directory and run 'setup.py install', which will build and install the module.
Now in order to access AWS you need to either put your credentials in a config file or pass them in your code. The former is much easier. All the documentation seems to indicate that you need to create a section called [credentials] in your boto.cfg file. Hmm, where is the boto.cfg file in windows. Can't find it. Never did find it. However you can set an environment variable called 'BOTO_CONFIG" that contains the path and the filename to the config file. Easy enough.
Credential set, environment variable set, help (boto) shows that it knows where the boto config file is located... hmm, still doesn't work. Still can't find the credentials. Odd. Oh wait, there is more... there is another environment variable called AWS_CREDENTIAL_FILE which should be set to the path to the file containing the [credentials] section. Now it works.
Why was that so hard to find information about? I have no idea. Maybe I just missed it, hopefully this will help someone else out who has missed it also.
No comments:
Post a Comment