I have multiple aws account and I want to manage most of the work via script. I am able to connect to ELB, EC2 using boto profile however I am not able to find out the same mechanism to work with RDS.
For EC2 connection my sample fucntion looks like this :
def Ec2Conn(reg,profile = 'default'):
ec2conn = ''
try:
ec2conn = boto.ec2.EC2Connection(profile_name=profile, region=boto.ec2.get_region(reg.strip()))
except Exception, e:
boto.log.error("Cannot validate provided AWS credentials: %s" % e)
return(ec2conn)
If reg(region) passed to function it will read that else it will select the region set default in aws boto. Similarly if no option given for profile it takes default profile from boto.
However I am unable to do the same with RDS connection.
Sample code which I thought could work for RDS connection with boto profile but unfortunately not working :
def RDSConn(reg,profile = 'default'):
rdsconn = ''
try:
rdsconn = boto.rds2.connect_to_region(region=boto.ec2.get_region(reg.strip()), profile_name=profile)
except Exception, e:
boto.log.error("Cannot validate provided AWS credentials: %s" % e)
return(elbconn)
Oops this is awe!! :
>>> dir(boto.rds2)
['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'connect_to_region', 'get_regions', 'regions']
>>>
Boto rds2 does not have any method for profile in it.
Boto version I am running on my box is as below :
>>> print boto.Version
2.39.0
Any one who faced the same issue. Any suggestion plz.