I am in the early stages of developing a dotnet core web, which is being deployed to an Ubuntu server. The app is running under the www-data user, via a systemd service (following this guide https://docs.microsoft.com/en-us/aspnet/core/publishing/linuxproduction).
The app connects to the Amazon S3 service by specifying credentials generated by the AWS command line interface i.e. aws configure (http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html)
I've tried various approaches to have the app read the credential file, including trying to set an Environment property in the serviced definition, explicitly setting ProfilesLocation in my appsettings.json file.
My current working solution is to copy the ~/.aws folder and contents to the /var/www/.aws path, and setting the owner to be www-data. Although this works, I'm unsure if this is the best practice, and concerned if it's secure or not.
Is this approach reasonable, if not what should I be doing instead?
Thanks