leeroybrun / glacier-vault-remove

Remove all archives stored inside an Amazon Glacier vault, even if you have a huge number of them.
379 stars 50 forks source link

HTTPS connection fails #32

Closed wellixl closed 7 years ago

wellixl commented 7 years ago

I've created a new Access and secret key but i repeatedly get the error security token included in the request is invalid. I've double and triple checked these and they are correct,

image

wellixl commented 7 years ago

If I modify line 90 and put the keys in there it does make a connection, brings back a list and my account id - however when i then try to delete a vault I still get the invalid security token message

raphael-riel commented 7 years ago

Is your credentials.json file build in respect to what's expected by the script? If no file provided, JSON is invalid or some keys are missing , the script assumes it's running on a EC2 with appropriate IAM Role attached (And logs an error).

# Load credentials
try:
    f = open('credentials.json', 'r')
    config = json.loads(f.read())
    f.close()

    os.environ['AWS_ACCESS_KEY_ID'] = config['AWSAccessKeyId']
    os.environ['AWS_SECRET_ACCESS_KEY'] = config['AWSSecretKey']

except:
    logging.error('Cannot load "credentials.json" file... Assuming Role Authentication.')
wellixl commented 7 years ago

Ah it's probably the IAM Role, strangely I changed the script back and it appears to be working now. This is more likely to be my understanding rather than a code fault.