Importer et télécharger des objets de stockage dans des projets
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment importer et télécharger des objets vers et depuis des buckets de stockage isolés Google Distributed Cloud (GDC).
Avant de commencer
Un espace de noms de projet gère les ressources de bucket sur le serveur de l'API Management. Vous devez disposer d'un projet pour travailler avec des buckets et des objets.
Vous devez également disposer des autorisations de bucket appropriées pour effectuer l'opération suivante. Consultez Accorder l'accès à un bucket.
Consignes de dénomination des objets
Suivez les consignes ci-dessous pour nommer les objets :
Utilisez des caractères UTF-8 pour nommer les objets.
N'incluez aucune information permettant d'identifier personnellement l'utilisateur.
Importer des objets dans des buckets de stockage
Console
Dans le menu de navigation, cliquez sur Stockage d'objets.
Cliquez sur le nom du bucket dans lequel vous souhaitez importer l'objet.
Facultatif : Si vous souhaitez créer un dossier pour stocker votre objet, cliquez sur Créer un dossier > saisissez un nom de dossier > cliquez sur Créer.
Cliquez directement sur Importer un fichier ou accédez au dossier que vous venez de créer, puis cliquez sur Importer un fichier.
Sélectionnez le fichier souhaité, puis cliquez sur Ouvrir.
Attendez le message de confirmation indiquant que l'importation a réussi.
CLI
Pour importer un objet, exécutez les commandes suivantes :
Les commandes suivantes nécessitent FULLY_QUALIFIED_BUCKET_NAME. Utilisez la commande GET ou DESCRIBE de la section Afficher la configuration du bucket pour obtenir le nom complet du bucket.
La commande suivante importe tous les fichiers texte du répertoire local dans un bucket :
Pour importer un dossier dans un bucket, utilisez l'option --recursive afin de copier une arborescence de répertoires entière. La commande suivante importe l'arborescence de répertoires dir :
Effectuez des importations en plusieurs parties pour les objets volumineux ou utilisez-les automatiquement lorsque vous avez un fichier de plus de 15 Mo à importer.
Dans ce cas, le fichier est divisé en plusieurs parties de 15 Mo chacune.
La dernière partie est plus petite. Chaque partie est importée séparément et reconstruite à la destination une fois le transfert terminé.
Si l'importation d'une partie échoue, vous pouvez la relancer sans affecter les autres parties déjà importées.
Deux options sont disponibles pour les importations multiparties :
--disable-multipart : désactive les importations en plusieurs parties pour tous les fichiers.
--multipart-chunk-size-mb=SIZE : définit la taille de chaque bloc d'une importation multipartie.
Les fichiers de plus de SIZE sont automatiquement importés en tant que fichiers multipart multithread. Les fichiers moins volumineux sont importés à l'aide de la méthode traditionnelle. SIZE est exprimée en mégaoctets. La taille de bloc par défaut est de 15 Mo. La taille minimale autorisée pour un bloc est de 5 Mo, et la taille maximale est de 5 Go.
Télécharger des objets à partir de buckets de stockage
Console
Dans le menu de navigation, cliquez sur Stockage d'objets.
Cliquez sur le nom du bucket contenant les objets.
Cochez la case à côté du nom de l'objet à télécharger.
Pour une personnalisation plus poussée, vous pouvez créer votre propre AEADKey et l'utiliser directement lorsque vous chiffrez des objets dans votre bucket. Vous disposez ainsi d'un contrôle total sur la clé de chiffrement, en contournant la clé par défaut. Suivez Créer une clé pour créer une AEADKey et assurez-vous qu'elle se trouve dans le même Namespace que le bucket que vous souhaitez utiliser. Ensuite, chaque fois que vous envoyez la requête, assurez-vous que HEADER est configuré avec x-amz-server-side-encryption: SSE-KMS et x-amz-server-side-encryption-aws-kms-key-id: NAMESPACE_NAME/AEADKey_NAME.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis page details the process of uploading and downloading objects within Google Distributed Cloud (GDC) air-gapped storage buckets, requiring a project namespace and appropriate bucket permissions.\u003c/p\u003e\n"],["\u003cp\u003eObjects can be uploaded to storage buckets via the console by navigating to the Object Storage section, selecting a bucket, and using the "Upload file" function or through the CLI by using the \u003ccode\u003egdcloud storage cp\u003c/code\u003e commands, also offering multipart upload support for large files.\u003c/p\u003e\n"],["\u003cp\u003eObject naming must use UTF-8 characters and should not include personally identifiable information (PII).\u003c/p\u003e\n"],["\u003cp\u003eObjects can be downloaded from storage buckets using both the console, through the "Download" feature, and the CLI, with the \u003ccode\u003egdcloud storage cp\u003c/code\u003e command, with options to download specific versions of files.\u003c/p\u003e\n"],["\u003cp\u003eCustom AEADKeys can be created and used for object encryption, providing full control over the encryption key by setting specific headers in the request, replacing default key functionality.\u003c/p\u003e\n"]]],[],null,["# Upload and download storage objects in projects\n\nThis page shows you how to upload and download objects to and from Google Distributed Cloud (GDC) air-gapped storage buckets.\n\nBefore you begin\n----------------\n\nA project namespace manages bucket resources in the Management API server. You\nmust have a [project](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/project-management) to work with buckets and objects.\n\nYou must also have the appropriate bucket permissions to perform the following\noperation. See [Grant bucket access](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/grant-obtain-storage-access#grant_bucket_access).\n\nObject naming guidelines\n------------------------\n\nUse the following guidelines to name objects:\n\n- Use UTF-8 characters when naming objects.\n- Refrain from including any personally identifiable information (PII).\n\nUpload objects to storage buckets\n---------------------------------\n\n### Console\n\n1. In the navigation menu, click **Object Storage**.\n2. Click the name of the bucket you want to upload the object to.\n3. Optional: If you want to create a folder to store your object, click **Create folder** \\\u003e enter a folder name \\\u003e click **Create**.\n4. Click **Upload file** directly, or navigate into the folder you just created and then click **Upload file**.\n5. Select the desired file and click **Open**.\n6. Wait for the confirmation message that the upload was successful.\n\n### CLI\n\nTo upload an object, run the following commands: \n\n gdcloud storage cp \u003cvar translate=\"no\"\u003eLOCAL_PATH\u003c/var\u003e s3://\u003cvar translate=\"no\"\u003eREMOTE_PATH\u003c/var\u003e\n gdcloud storage cp s3://\u003cvar translate=\"no\"\u003eREMOTE_SOURCE_PATH\u003c/var\u003e s3://\u003cvar translate=\"no\"\u003eREMOTE_MOVE_DESTINATION_PATH\u003c/var\u003e\n gdcloud storage mv s3://\u003cvar translate=\"no\"\u003eREMOTE_SOURCE_PATH\u003c/var\u003e s3://\u003cvar translate=\"no\"\u003eREMOTE_MOVE_DESTINATION_PATH\u003c/var\u003e\n\nThe following commands require the \u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e. Use the `GET` or `DESCRIBE` command from the [View bucket configuration](/distributed-cloud/hosted/docs/latest/gdch/platform/pa-user/list-view-storage-buckets#view_bucket_configurations) section to get the fully qualified bucket name.\n\nThe following command uploads all text files from the local directory to a bucket: \n\n gdcloud storage cp *.txt s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e\n\nThe following command uploads multiple files from the local directory to a bucket: \n\n gdcloud storage cp abc1.txt abc2.txt s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e\n\nTo upload a folder to a bucket, use the --recursive option to copy an entire directory tree. The following command uploads the directory tree dir: \n\n gdcloud storage cp dir s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e --recursive\n\nPerform multipart uploads for large objects, or use multipart\nuploads automatically when you have a file to upload that is larger than 15 MB.\nIn that case, the file splits into multiple parts, with each part being 15 MB in size.\nThe last part is smaller. Each part uploads separately and reconstructs at\nthe destination when the transfer completes.\n\nIf an upload of one part fails, you can restart the upload without affecting any\nof the other parts already uploaded.\n\nThere are two options related to multipart uploads:\n\n- `--disable-multipart`: disables multipart uploads for all files.\n- `--multipart-chunk-size-mb=`\u003cvar translate=\"no\"\u003eSIZE\u003c/var\u003e: sets the size of each chunk of a multipart upload.\n\nFiles bigger than \u003cvar translate=\"no\"\u003eSIZE\u003c/var\u003e automatically upload as\nmultithreaded-multipart. Smaller files upload using the traditional\nmethod. \u003cvar translate=\"no\"\u003eSIZE\u003c/var\u003e is in megabytes. The default chunk size is\n15 MB. The minimum allowed chunk size is 5 MB, and the maximum is 5 GB.\n\nDownload objects from storage buckets\n-------------------------------------\n\n### Console\n\n1. In the navigation menu, click **Object Storage**.\n2. Click the name of the bucket containing the objects.\n3. Select the checkbox next to the name of the object to download.\n4. Click **Download**.\n\n### CLI\n\nTo get objects from the bucket: \n\n gdcloud storage cp s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e/\u003cvar translate=\"no\"\u003eOBJECT\u003c/var\u003e \u003cvar translate=\"no\"\u003eLOCAL_FILE_TO_SAVE\u003c/var\u003e\n\nTo download all text files from a bucket to your current directory: \n\n gdcloud storage cp s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e/*.txt .\n\nTo download the text file `abc.txt` from a bucket to your current directory: \n\n gdcloud storage cp s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e/abc.txt .\n\nTo download an older version of the file, list all versions of the file first: \n\n gdcloud storage ls s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e/abc.txt --all-versions\n\nExample output: \n\n s3://my-bucket/abc.txt#OEQxNTk4MUEtMzEzRS0xMUVFLTk2N0UtQkM4MjAwQkJENjND\n s3://my-bucket/abc.txt#ODgzNEYzQ0MtMzEzRS0xMUVFLTk2NEItMjI1MTAwQkJENjND\n s3://my-bucket/abc.txt#ODNCNDEzNzgtMzEzRS0xMUVFLTlDOUMtQzRDOTAwQjg3RTg3\n\nThen, download a specific version of the text file `abc.txt` from the bucket to your current directory: \n\n gdcloud storage cp s3://\u003cvar translate=\"no\"\u003eFULLY_QUALIFIED_BUCKET_NAME\u003c/var\u003e/abc.txt#OEQxNTk4MUEtMzEzRS0xMUVFLTk2N0UtQkM4MjAwQkJENjND .\n\nUse custom AEADKey\n------------------\n\nFor greater customization, you can create your own AEADKey and use it directly when encrypting objects in your bucket. This gives you full control over the encryption key, bypassing the default. Follow [Create a key](/distributed-cloud/hosted/docs/latest/gdch/application/ao-user/kms/create-delete-keys#create) to create a new AEADKey and make sure it's in the same `Namespace` as the bucket you intend to use. Then, whenever sending the request, make sure the `HEADER` is configured with `x-amz-server-side-encryption: SSE-KMS` and `x-amz-server-side-encryption-aws-kms-key-id: `\u003cvar translate=\"no\"\u003eNAMESPACE_NAME\u003c/var\u003e`/`\u003cvar translate=\"no\"\u003eAEADKey_NAME\u003c/var\u003e"]]