boto issue with IAM role

后端 未结 2 1179
眼角桃花
眼角桃花 2020-12-08 21:10

I\'m trying to use AWS\' recently announced \"IAM roles for EC2\" feature, which lets security credentials automatically get delivered to EC2 instances. (see http://aws.ama

2条回答
  •  萌比男神i
    2020-12-08 21:23

    I don't know if this answer will help anyone but I was getting the same error, I had to solve my problem a little differently. First, my amazon instance did not have any IAM roles. I thought I could just use the access key and the secret key but I kept getting this error with only those two keys. I read I needed a security token as well, but I didn't have one because I didn't have any IAM roles. This is what I did to correct the issue:

    1. Create an IAM role with AmazonS3FullAccess permissions.
    2. Start a new instance and attach my newly created role.
    3. Even after doing this it still didn't work. I had to also connect to the proper region with the code below:

      import boto.s3.connection
      conn = boto.s3.connect_to_region('your-region')
      conn.get_all_buckets()

提交回复
热议问题