Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.
Copia di un oggetto utilizzando il caricamento in più parti
Gli esempi in questa sezione mostrano come copiare oggetti di dimensioni superiori a 5 GB utilizzando il caricamento in più parti. API È possibile copiare oggetti con dimensioni inferiori a 5 GB in una sola operazione. Per ulteriori informazioni, consulta Copiare, spostare e rinominare oggetti.
Per copiare un oggetto utilizzando il livello bassoAPI, procedi come segue:
-
Avvia il caricamento in più parti chiamando il metodo
AmazonS3Client.initiateMultipartUpload()
. -
Salvare l'ID caricamento dall'oggetto della risposta restituito dal metodo
AmazonS3Client.initiateMultipartUpload()
. Si fornisce questo ID di caricamento per ciascuna operazione di caricamento di parte. -
Copia tutte le parti. Per ciascuna parte che è necessario copiare, creare una nuova istanza della classe
CopyPartRequest
. Fornisci le informazioni sulla parte, inclusi i nomi bucket di origine e destinazione, le chiavi dell'oggetto di origine e destinazione, l'ID di caricamento, le posizioni dei primi e degli ultimi byte della parte e il numero della parte. -
Salva le risposte che il metodo
AmazonS3Client.copyPart()
chiama. Ogni risposta include il valoreETag
e il numero della parte per la parte caricata. Tali informazioni saranno necessarie per completare il caricamento in più parti. -
Chiama il metodo
AmazonS3Client.completeMultipartUpload()
per completare l'operazione di copia.
Le seguenti sezioni di Amazon Simple Storage Service API Reference descrivono REST API il caricamento in più parti. Per copiare un oggetto esistente, usa Upload Part (Copy) API e specifica l'oggetto sorgente aggiungendo l'intestazione della x-amz-copy-source
richiesta nella richiesta.
Puoi usarli APIs per fare REST le tue richieste oppure puoi utilizzare una delle SDKs nostre opzioni. Per ulteriori informazioni sull'utilizzo di Multipart Upload con AWS CLI, consulta Utilizzo di AWS CLI. Per ulteriori informazioni suSDKs, vedereAWS Supporto SDK per il caricamento in più parti.