title: How do I upload a file to a pre-signed URL in AWS using Java?
body: <pre><code>URL url = new URL("https://prod-us-west-2-uploads.s3-us-west-2.amazonaws.com/arn%3Aaws%3Adevicefarm%3Aus-west-2%3A225178842088%3Aproject%3A1e6bbc52-5070-4505-b4aa-592d5e807b15/uploads/arn%3Aaws%3Adevicefarm%3Aus-west-2%3A225178842088%3Aupload%3A1e6bbc52-5070-4505-b4aa-592d5e807b15/501fdfee-877b-42b7-b180-de584309a082/Hamza-test-app.apk?X-Amz-Algorithm=AWS4-HMAC-SHA256&amp;X-Amz-Date=20181011T092801Z&amp;X-Amz-SignedHeaders=host&amp;X-Amz-Expires=86400&amp;X-Amz-Credential=AKIAJSORV74ENYFBITRQ%2F20181011%2Fus-west-2%2Fs3%2Faws4_request&amp;X-Amz-Signature=f041f2bf43eca1ba993fbf7185ad8bcb8eccec8429f2877bc32ab22a761fa2a");
          File file = new File("C:\\Users\\Hamza\\Desktop\\Hamza-test-app.apk");
          //Create Connection
          HttpURLConnection connection =  (HttpURLConnection) url.openConnection();
          connection.setDoOutput(true);
          connection.setRequestMethod("PUT");
          BufferedOutputStream bos = new BufferedOutputStream(connection.getOutputStream());
          BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
          int i;
          // read byte by byte until end of stream
          while ((i = bis.read()) &gt; 0) {
      bos.write(i);
          }
          bos.flush();
          bis.close();
          bos.close();
  
  
          System.out.println("HTTP response code: " + connection.getResponseCode());
      }catch(Exception ex){
          System.out.println("Failed to Upload File");
      }
  </code></pre>
  
  <p>i want to upload a file to aws farm devices in java but file is not uploading to aws project upload list.</p>