- try:
- #VPC Connection
- self.vpc_conn = boto.vpc.connect_to_region(self.AWS_REGION,
- aws_access_key_id=self.AWS_KEY,
- aws_secret_access_key=self.AWS_SECRET)
-
-
- #EC2 Connection
- self.ec2_conn = boto.ec2.connect_to_region(self.AWS_REGION,
- aws_access_key_id=self.AWS_KEY,
- aws_secret_access_key=self.AWS_SECRET)
-
-
- """ TODO : Required to add actions against alarms when needed """
- #self.sns = connect_to_region(self.AWS_REGION)
- #self.topics = self.sns.get_all_topics()
- #self.topic = self.topics[u'ListTopicsResponse']['ListTopicsResult']['Topics'][0]['TopicArn']
-
- #Cloudwatch Connection
- self.cloudwatch_conn = boto.ec2.cloudwatch.connect_to_region(
- self.AWS_REGION,
- aws_access_key_id=self.AWS_KEY,
- aws_secret_access_key=self.AWS_SECRET)
- connection_dict = dict()
- connection_dict['ec2_connection'] = self.ec2_conn
- connection_dict['cloudwatch_connection'] = self.cloudwatch_conn
- return connection_dict
-
- except Exception as e:
- log.error("Failed to Connect with AWS %s: ",str(e))
+ try:
+ # VPC Connection
+ self.vpc_conn = boto.vpc.connect_to_region(self.AWS_REGION,
+ aws_access_key_id=self.AWS_KEY,
+ aws_secret_access_key=self.AWS_SECRET)
+
+ # EC2 Connection
+ self.ec2_conn = boto.ec2.connect_to_region(self.AWS_REGION,
+ aws_access_key_id=self.AWS_KEY,
+ aws_secret_access_key=self.AWS_SECRET)
+
+ """ TODO : Required to add actions against alarms when needed """
+ # self.sns = connect_to_region(self.AWS_REGION)
+ # self.topics = self.sns.get_all_topics()
+ # self.topic = self.topics[u'ListTopicsResponse']['ListTopicsResult']['Topics'][0]['TopicArn']
+
+ # Cloudwatch Connection
+ self.cloudwatch_conn = boto.ec2.cloudwatch.connect_to_region(
+ self.AWS_REGION,
+ aws_access_key_id=self.AWS_KEY,
+ aws_secret_access_key=self.AWS_SECRET)
+ connection_dict = dict()
+ connection_dict['ec2_connection'] = self.ec2_conn
+ connection_dict['cloudwatch_connection'] = self.cloudwatch_conn
+ return connection_dict