Search code examples
amazon-web-servicesamazon-s3aws-cli

S3 UploadPartCopy: Invalid resource in copy source ARN


I'd like to use UploadPartCopy to copy a large object from one region to another region (different accounts, no access points)

AWS cli returns following error:

~ aws s3api upload-part-copy \
    --bucket my-objects \
    --key "my-bucket/temp1.png" \
    --copy-source "arn:aws:s3:us-east-1:123451980301:my-objects/my-bucket/temp.png" \
    --part-number 1 \
    --upload-id ".OjnTTL4zciiCx5U56ED89sgfWNfowZZYCn9iSxhYIThSI8Pqa.Fp1tg6KaiR4fbejyzCIvrzcTbUiMnIT3DGfoVQmQaZuMVDeA8q_OWomKDNmRNKtcH.cm0LRUtHjuJ"


An error occurred (InvalidArgument) when calling the UploadPartCopy operation: Invalid resource in copy source ARN

Prior to this command, I used create-multipart-upload to get the upload id.

Is it possible to fix this issue?


Solution

  • --copy-source should be in the format of:

    my-bucket/temp.png
    

    as explained in the docs:

    For objects not accessed through an access point, specify the name of the source bucket and key of the source object, separated by a slash (/). For example, to copy the object reports/january.pdf from the bucket awsexamplebucket , use awsexamplebucket/reports/january.pdf

    ARN is used for access points, not regular s3 objects.