title: aws ec2 instance - permission denied to write to ~/.aws/credentials
body: <p>When <code>ssh</code> into a aws ec2 linux instance, the user is <code>ec2-user</code> by default. Then I need to set aws credentials by writing to <code>~/.aws/credentials</code>, but got permission denied. I feel that if I use <code>sudo</code> then the <code>credentials</code> file would be owned by <code>root</code> user, as a result my api server can't read from it.</p>
  
  <p>What's the correct approach to set up aws credentials there?</p>