def get_subnets(self):
try:
client = boto3.client('ec2',
aws_access_key_id=self.access_key_id,
aws_secret_access_key=self.secret_access_key,
region_name=self.region_name)
except Exception as e:
raise AWSException("There was an error connecting to EC2: %s" % e)
# Search EC2 for the VPC subnets
try:
return client.describe_subnets()
except botocore.exceptions.ClientError as e:
raise AWSException("There was an error describing the VPC Subnets: %s" %
e.response["Error"]["Message"])
except botocore.exceptions.ParamValidationError as e:
raise AWSException("There was an error describing the VPC Subnets: %s" % e)
评论列表
文章目录