title: The AWS Access Key Id you provided does not exist in our records, when loading in corect AWS credentials
body: <p>I'm creating a spring boot backend, that can't seem to upload an image with a presigned url i have tried from three different clients now (postman, react, the backend itself).</p>
  <p>All clients returns the same client.</p>
  <p>In the very top i have declared a configuration like such:</p>
  <pre class="lang-java prettyprint-override"><code>
      @Bean
      @Scope(&quot;singleton&quot;)
      public S3Service provideS3Service(){
  
           String secretKey = environment.getProperty(&quot;aws.key.secret&quot;);
           String accessKey = environment.getProperty(&quot;aws.key.access&quot;);
           String bucketName = environment.getProperty(&quot;aws.bucket.name&quot;);
           AWSCredentials awsCredentials = new BasicAWSCredentials(accessKey, secretKey);
  
           String regionName = environment.getProperty(&quot;aws.bucket.region&quot;);
           Regions clientRegion = Regions.valueOf(regionName);
  
           System.out.println(awsCredentials.getAWSAccessKeyId());
           System.out.println(awsCredentials.getAWSSecretKey());
           AmazonS3 s3Client = AmazonS3ClientBuilder.standard()
                  .withCredentials(new AWSStaticCredentialsProvider(awsCredentials))
                  .withRegion(clientRegion)
                  .build();
           S3Service s3Service = new S3Service(bucketName, s3Client);
  
  
           return s3Service;
  
  
      }
  </code></pre>
  <p>Inside my S3 Service I have the following function to make the request. Right now i have also mocked the request which writes to aws.</p>
  <pre class="lang-java prettyprint-override"><code>
      public PresignedUrlResponse createSignedUrlPost() throws IOException {
          String objectKey = UUID.randomUUID().toString();
          LocalDateTime expiration = getExpirationDate();
  
          Date expirationDate = Date.from(expiration.atZone(ZoneId.systemDefault()).toInstant());
          GeneratePresignedUrlRequest generatePresignedUrlRequest =
                  new GeneratePresignedUrlRequest(this.bucketName, objectKey)
                  .withMethod(HttpMethod.POST)
                  .withExpiration(expirationDate);
  
          URL url = amazonS3.generatePresignedUrl(generatePresignedUrlRequest);
  
          // Create the connection and use it to upload the new object using the pre-signed URL.
          HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          connection.setDoOutput(true);
          connection.setRequestMethod(&quot;PUT&quot;);
          OutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());
          out.write(&quot;This text uploaded as an object via presigned URL.&quot;);
          out.close();
  
          // Check the HTTP response code. To complete the upload and make the object available,
          // you must interact with the connection object in some way.
          connection.getResponseCode();
          System.out.println(&quot;HTTP response code: &quot; + connection.getResponseCode());
  
          // Check to make sure that the object was uploaded successfully.
          S3Object object = amazonS3.getObject(bucketName, objectKey);
          System.out.println(&quot;Object &quot; + object.getKey() + &quot; created in bucket &quot; + object.getBucketName());
  
  
          return new PresignedUrlResponse(url.toString(), expiration);
      }
      
  </code></pre>
  <p>This corresponds to the followin error:</p>
  <pre><code>{
    &quot;timestamp&quot;: &quot;Jul 18, 2020, 7:46:43 PM&quot;,
    &quot;status&quot;: 500,
    &quot;error&quot;: &quot;Internal Server Error&quot;,
    &quot;message&quot;: &quot;The AWS Access Key Id you provided does not exist in our records. (Service: Amazon S3; Status Code: 403; Error Code: InvalidAccessKeyId; Request ID: DD94BBA0C28610CA; S3 Extended Request ID: tyyQDCnKD6ni+6uwumWh3psUvWM8TOVNguP8Y0dvkBPgmmUdebnrq+RBKqmXQcVQUyOxbqM5//o=; Proxy: null)&quot;,
    &quot;path&quot;: &quot;/chat/channels/signedurl&quot;
  }
  </code></pre>
  <p>I have ensured, that the credentials is correctly sat, and that they can be logged from the console aswell.</p>
  <pre class="lang-java prettyprint-override"><code>
           System.out.println(awsCredentials.getAWSAccessKeyId());
           System.out.println(awsCredentials.getAWSSecretKey());
  </code></pre>
  <p><a href="https://i.stack.imgur.com/QZaW2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QZaW2.png" alt="printed credentials" /></a></p>
  <p>I have checked, that the credentials match that on my AWS account.
  Does anybody have any idea, what this issue, could be caused by?</p>
  <p>I have tried everything now.</p>