def _connect(self):
resource = None<EOL>try:<EOL><INDENT>resource = boto3.resource(<EOL>'<STR_LIT>',<EOL>aws_access_key_id=self.access_key_id,<EOL>aws_secret_access_key=self.secret_access_key,<EOL>region_name=self.region<EOL>)<EOL>resource.meta.client.describe_account_attributes()<EOL><DEDENT>except Exception:<EOL><INDENT>raise EC2CloudException(<EOL>'<STR_LIT>' % self.region<EOL>)<EOL><DEDENT>return resource<EOL>
Connect to ec2 resource.