title: Transfer files between Amazon S3 buckets in Unity
body: <p>I'm trying to transfer files between S3 buckets inside Unity, and running into cryptic errors that I can't find documentation on. Both buckets belong to the same account.</p>
  <p>Whenever I create an asset, I upload it to S3 servers in the Dev Bucket, which works great. When I'm ready to commit assets, I want to go through a list of assets missing from the Prod Bucket and transfer them over from the Dev Bucket. From my research, <code>IAmazonS3. CopyObjectAsync()</code> is the function that should do this task. The <code>IAmazonS3.CopyObject()</code> <a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjectUsingNetSDK.html" rel="nofollow noreferrer">function</a> is <strong>not</strong> available in Amazon's Unity SDK.</p>
  <p>Here's the code I call while trying to copy the object:</p>
  <pre><code>public void TestCopy()
  {
      var request = new CopyObjectRequest()
      {
          SourceBucket = mLoginData.DevBucket,
          SourceKey =  &quot;myPic.jpg&quot;,
          DestinationBucket = mLoginData.ProdBucket,
          DestinationKey = &quot;myPic.jpg&quot;
      };
  
      AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
  
      Client.CopyObjectAsync(request,(responseObj) =&gt;
      {
          if (responseObj.Exception == null)
          {
              ResultText.text += &quot;Copied Object&quot;;
          }
          else
          {
              ResultText.text += &quot;Got Exception: \n&quot; + responseObj.Exception.ToString();
          }
      });
  }
  </code></pre>
  <p>This results in a &quot;Moved&quot; error code that isn't mentioned in the <a href="http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html" rel="nofollow noreferrer">Amazon Error Code documentation</a>:</p>
  <pre><code>Got Exception: 
  Amazon.S3.AmazonS3Exception: Error making request with Error Code Moved and Http Status Code Moved. No further error information was returned by the service. Response Body: Encountered invalid redirect (missing Location header?) ---&gt; Amazon.Runtime.Internal.HttpErrorResponseException: Exception of type 'Amazon.Runtime.Internal.HttpErrorResponseException' was thrown.
  at Amazon.Runtime.Internal.UnityRequest.EndGetResponse (IAsyncResult asyncResult) [0x00000] in &lt;filename unknown&gt;:0 
  at Amazon.Runtime.Internal.HttpHandler`1[System.String].GetResponseCallbackHelper (System.Object state) [0x00000] in &lt;filename unknown&gt;:0 
  --- End of inner exception stack trace ---
  at Amazon.Runtime.Internal.HttpErrorResponseExceptionHandler.HandleException (IExecutionContext executionContext, Amazon.Runtime.Internal.HttpErrorResponseException exception) [0x00000] in &lt;filename unknown&gt;:0 
  at Amazon.Runtime.Internal.ExceptionHandler`1[T].Handle (IExecutionContext executionContext, System.Exception exception) [0x00000] in &lt;filename unknown&gt;:0 
  at Amazon.Runtime.Internal.ErrorHandler.ProcessException (IExecutionContext executionContext, System.Exception exception) [0x00000] in &lt;filename unknown&gt;:0 
  at Amazon.Runtime.Internal.ErrorHandler.InvokeAsyncCallback (IAsyncExecutionContext executionContext) [0x00000] in &lt;filename unknown&gt;:0 
  </code></pre>
  <p>I know that I'm set up correctly because I'm able to view/list buckets, upload/list/delete files to both buckets, etc. It's critical that the solution executes from the Unity Editor.</p>