If you are running locally, you should be using your own secret keys that are configured in your user directory with
aws configure
If you are running on anything within AWS you should be using a role attached to your EC2 instance or lambda and the SDK can retrieve your keys automatically.Unfortunately, every single third party code sample on the internet has you including the secret keys in your code.
I have seen people doing this in their Dockerfile
ADD . /src
To add all the sources in the image, and inadvertently just made public all the secrets that were in the .env file.Personally, I like to keep all my secrets very far from my repository.
Using a .env file is a bit of an anti-pattern, partly because many applications expect it and thus will be affected by it in ways you might not want. But also because passing configuration to applications via environment is not great, because then the values ar all static and the only way to change them is to restart the app. Better to have a function that can reload a real data format (json, yaml, ini) at run-time.
Each environment that runs your app will need to have its own 'env file' because every environment is slightly different, and they're coupled to deployments. So I'd keep your environment stuff wherever your deployment stuff is; with your terraform/ansible/puppet/chef configs, or etc/consul, or an S3 bucket, or SSM, etc. Create it at deploy time, pull it into the app at run time.