i have set the config variable using the following code
heroku config:set --app xxxxxx S3_KEY=XXXXXXXXXXXXXXX S3_SECRET_ACCESS_KEY=XXXXXXXXXXXXXXXXXXXXX S3_BUCKET =XXXXXXXXXXXX
got the following reply:
Setting S3_KEY, S3_SECRET_ACCESS_KEY, S3_BUCKET and restarting ⬢ xxxx... done, v46
S3_BUCKET: XXXXXXXXX
S3_KEY: XXXXXXXXXXXXXX
S3_SECRET_ACCESS_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
here is my helper.py function where i set the boto3 client:
import boto3, botocore
from config import S3_KEY, S3_SECRET, S3_BUCKET
import os
s3 = boto3.client(
"s3",
region_name='us-east-1',
aws_access_key_id=os.environ['S3_KEY'],
aws_secret_access_key=os.environ['S3_SECRET_ACCESS_KEY']
)
s3Res = boto3.resource('s3', region_name='us-east-1')
but it is not working, i keep getting the error :
botocore.exceptions.NoCredentialsError: Unable to locate credentials
what am i doing wrong? how can i get s3 to work with my heroku flask app?