'How can I set the ~/.aws/credentials on heroku?

I'm deploying my application on Heroku and I'm trying to read files from s3 buckets, but I can't find good references about how to set the ~/.aws/credentials on Heroku context;

I'm working all day on it and trying to figure out how to solve this problem

In my local environment, I'm using the following configuration to make it works: enter image description here

Someone could help me on how to set these values on Heroku, please?!?!?



Solution 1:[1]

You can use the following command in your local terminal

heroku config:set AWS_ACCESS_KEY_ID={ACCESS} AWS_SECRET_ACCESS_KEY={SECRET}

I have used this for AWS Dynamodb with Heroku and working fine.

Solution 2:[2]

[default]
aws_access_key_id=[yourkeyhere]
aws_secret_access_key=[yoursecretekeyhere]
[admin]
aws_access_key_id=[yourkeyhere]
aws_secret_access_key=[yoursecretekeyhere]

I have set as above and my site is working fine.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lasitha Yapa
Solution 2