Why are no Amazon S3 authentication handlers ready?

后端 未结 12 2126
广开言路
广开言路 2020-12-13 08:21

I have my $AWS_ACCESS_KEY_ID and $AWS_SECRET_ACCESS_KEY environment variables set properly, and I run this code:

import boto
conn = boto.connect_s3()
         


        
12条回答
  •  既然无缘
    2020-12-13 09:01

    I was having this issue with a flask application on ec2. I didn't want to put credentials in the application, but managed permission via IAM roles. That way can avoid hard-coding keys into code. Then I set a policy in the AWS console (I didn't even code it, I just used the policy generator)

    My code is exactly like OP's. The other solutions here are good but there is a way to grand permission without hard-coding access keys.

    1. Create an IAM security group that grants access to the S3 resource
    2. Give the policy to the EC2 instance
    3. Connect using nothing but boto.connect_s3() #no keys needed

提交回复
热议问题