擅长:python、mysql、java
<p>您没有足够的权限(<code>iam::PassRole</code>)将IAM角色附加到实例。所以附加一个政策,授予你特权。只有当您是IAM管理员或有足够的权限将策略附加到用户时,才能将策略附加到用户。在</p>
<ul>
<li>首先使用允许<code>PassRole</code>的策略文档<a href="http://boto3.readthedocs.io/en/latest/reference/services/iam.html#IAM.Client.create_policy" rel="nofollow noreferrer">create_policy</a>。请参见:<a href="https://stackoverflow.com/questions/45852308/how-to-give-ec2-instance-access-to-s3-using-boto3">How to give ec2 instance access to s3 using boto3</a></li>
<li>用户旁边的<a href="http://boto3.readthedocs.io/en/latest/reference/services/iam.html#IAM.Client.attach_user_policy" rel="nofollow noreferrer">attach_user_policy</a></li>
</ul>