python - How to validate Amazon access key and secret key is correct? -


i wrote function validate aws keys creating ec2 connection object

import boto.ec2 try:     ec2conn = boto.ec2.connect_to_region(region, aws_access_key_id=access_key, aws_secret_access_key=secret_key)     return ec2conn except boto.exception.ec2responseerror e:     print e 

but if secret key wrong still creates ec2 connection object.

so validate access key , secret key fetching regions,

region = ec2conn.get_all_regions() 

is there method or way rather fetching region validate access key , secret key?

the way verify aws credentials use them sign request , see if works. correct creating connection object tells nothing because doesn't perform request. have pick request should work, won't return huge amount of data, , doesn't create resources on server side. think get_all_regions() request pretty choice.


Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -