title: Authenticate AmazonS3 client without Credentials
body: <p>I am trying to upload to an S3 bucket using the <a href="https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/s3/AmazonS3.html" rel="nofollow noreferrer">AmazonS3 client</a>. I create it using the following code: </p>
  
  <pre><code>AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
     .withRegion(clientRegion)
     .withCredentials(new ProfileCredentialsProvider())
     .build();
  </code></pre>
  
  <p>This uses the <code>.aws/credentials</code> file to authenticate. My problem is that when I push this to an EC3 environment (not locally), it fails because the environment doesn't have this <code>.aws/credentials</code> file on it and we are not allowed to add the credentials for security reasons. </p>
  
  <p>How can I get around this? </p>