boto.exception.EC2ResponseError: EC2ResponseError: 403 Forbidden (rights issue or something else)
boto.exception.EC2ResponseError: EC2ResponseError: 403 Forbidden (rights issue or something else)
我正在尝试在我的 AWS 系统中获取弹性 IP,我不确定是我使用了不正确的代码还是权限问题。获取区域工作正常。但是,当我尝试获取 ip 地址时,它给出了权限问题:
regions = boto.ec2.regions()
for obj in regions:
print(obj.name)
输出:
us-east-1
ap-southeast-1
ap-东南-2
正在尝试获取 IP 地址
address1=boto.ec2.connection.EC2Connection()
print(address1.get_all_addresses())
错误如下:
Traceback (most recent call last):
File "C:/code/python_pro/AWS/connection_boto3.py", line 51, in <module>
print(address1.get_all_addresses())
File "C:\PycharmProjects\test\venv\lib\site-packages\boto\ec2\connection.py", line 1811, in get_all_addresses
return self.get_list('DescribeAddresses', params, [('item', Address)], verb='POST')
File "C:\PycharmProjects\test\venv\lib\site-packages\boto\connection.py", line 1186, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>4fe0918f-f508-4faa-a30f-37bcdb9bd812</RequestID></Response>
该错误清楚地表明您无权执行该操作。检查您的 IAM policy/role 权限
UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>4fe0918f-f508-4faa-a30f-37bcdb9bd812</RequestID></Response>
我正在尝试在我的 AWS 系统中获取弹性 IP,我不确定是我使用了不正确的代码还是权限问题。获取区域工作正常。但是,当我尝试获取 ip 地址时,它给出了权限问题:
regions = boto.ec2.regions()
for obj in regions:
print(obj.name)
输出:
us-east-1 ap-southeast-1 ap-东南-2
正在尝试获取 IP 地址
address1=boto.ec2.connection.EC2Connection()
print(address1.get_all_addresses())
错误如下:
Traceback (most recent call last):
File "C:/code/python_pro/AWS/connection_boto3.py", line 51, in <module>
print(address1.get_all_addresses())
File "C:\PycharmProjects\test\venv\lib\site-packages\boto\ec2\connection.py", line 1811, in get_all_addresses
return self.get_list('DescribeAddresses', params, [('item', Address)], verb='POST')
File "C:\PycharmProjects\test\venv\lib\site-packages\boto\connection.py", line 1186, in get_list
raise self.ResponseError(response.status, response.reason, body)
boto.exception.EC2ResponseError: EC2ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Response><Errors><Error><Code>UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>4fe0918f-f508-4faa-a30f-37bcdb9bd812</RequestID></Response>
该错误清楚地表明您无权执行该操作。检查您的 IAM policy/role 权限
UnauthorizedOperation</Code><Message>You are not authorized to perform this operation.</Message></Error></Errors><RequestID>4fe0918f-f508-4faa-a30f-37bcdb9bd812</RequestID></Response>