I have exported AWS ACCESS KEY and SECRET via the environment variables, is there way to use those variables in the boto script instead of writing them to a file on the system? I don't want to write the key and secret in any file on the remote server.
If by use you mean read them and feed them into boto: You don't need to do that. Boto reads them, and in all calls which would usually expect the aws_access_key_id=
and aws_secret_access_key=
parameters, you just leave them out altogether. Hence a call like this would work without problems:
# note that we don't pass any credentials here...
conn = boto.ec2.connect_to_region("eu-west-1")
Just be sure the environment variables are set correctly. These are the correct names to use:
AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
More details here: http://boto.readthedocs.org/en/latest/boto_config_tut.html#introduction