

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à.

# Procedura dettagliata: allegare le autorizzazioni POSIX durante il caricamento di oggetti in un bucket Amazon S3
<a name="attach-s3-posix-permissions"></a>

La procedura seguente illustra il processo di caricamento degli oggetti in Amazon S3 con autorizzazioni POSIX. In questo modo è possibile importare le autorizzazioni POSIX quando si crea un file system Amazon FSx collegato a quel bucket S3.

**Per caricare oggetti con autorizzazioni POSIX su Amazon S3**

1. Dal tuo computer o macchina locale, usa i seguenti comandi di esempio per creare una directory di test (`s3cptestdir`) e un file (`s3cptest.txt`) che verranno caricati nel bucket S3.

   ```
   $ mkdir s3cptestdir
   $ echo "S3cp metadata import test" >> s3cptestdir/s3cptest.txt
   $ ls -ld s3cptestdir/ s3cptestdir/s3cptest.txt
   drwxr-xr-x 3 500 500 96 Jan 8 11:29 s3cptestdir/
   -rw-r--r-- 1 500 500 26 Jan 8 11:29 s3cptestdir/s3cptest.txt
   ```

   Il file e la directory appena creati hanno un ID utente (UID) del proprietario del file e un ID di gruppo (GID) pari a 500 e autorizzazioni, come mostrato nell'esempio precedente.

1. Chiama l'API Amazon S3 per creare la directory `s3cptestdir` con le autorizzazioni per i metadati. È necessario specificare il nome della directory con una barra finale (). `/` Per informazioni sui metadati POSIX supportati, vedere. [Supporto per metadati POSIX per archivi di dati](posix-metadata-support.md)

   `{{bucket_name}}`Sostituiscilo con il nome effettivo del tuo bucket S3.

   ```
   $ aws s3api put-object --bucket {{bucket_name}} --key s3cptestdir/ --metadata '{"user-agent":"aws-fsx-lustre" , \
         "file-atime":"1595002920000000000ns" , "file-owner":"500" , "file-permissions":"0100664","file-group":"500" , \
         "file-mtime":"1595002920000000000ns"}'
   ```

1. Verifica che le autorizzazioni POSIX siano contrassegnate con i metadati degli oggetti S3.

   ```
   $ aws s3api head-object --bucket {{bucket_name}} --key s3cptestdir/
   {
       "AcceptRanges": "bytes",
       "LastModified": "Fri, 08 Jan 2021 17:32:27 GMT",
       "ContentLength": 0,
       "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
       "VersionId": "bAlhCoWq7aIEjc3R6Myc6UOb8sHHtJkR",
       "ContentType": "binary/octet-stream",
       "Metadata": {
           "user-agent": "aws-fsx-lustre",
           "file-atime": "1595002920000000000ns",
           "file-owner": "500",
           "file-permissions": "0100664",
           "file-group": "500",
           "file-mtime": "1595002920000000000ns"
       }
   }
   ```

1. Carica il file di test (creato nel passaggio 1) dal tuo computer al bucket S3 con le autorizzazioni per i metadati.

   ```
   $ aws s3 cp s3cptestdir/s3cptest.txt s3://{{bucket_name}}/s3cptestdir/s3cptest.txt \
         --metadata '{"user-agent":"aws-fsx-lustre" , "file-atime":"1595002920000000000ns" , \
         "file-owner":"500" , "file-permissions":"0100664","file-group":"500" , "file-mtime":"1595002920000000000ns"}'
   ```

1. Verifica che le autorizzazioni POSIX siano contrassegnate con i metadati degli oggetti S3.

   ```
   $ aws s3api head-object --bucket {{bucket_name}} --key s3cptestdir/s3cptest.txt
   {
       "AcceptRanges": "bytes",
       "LastModified": "Fri, 08 Jan 2021 17:33:35 GMT",
       "ContentLength": 26,
       "ETag": "\"eb33f7e1f44a14a8e2f9475ae3fc45d3\"",
       "VersionId": "w9ztRoEhB832m8NC3a_JTlTyIx7Uzql6",
       "ContentType": "text/plain",
       "Metadata": {
           "user-agent": "aws-fsx-lustre",
           "file-atime": "1595002920000000000ns",
           "file-owner": "500",
           "file-permissions": "0100664",
           "file-group": "500",
           "file-mtime": "1595002920000000000ns"
       }
   }
   ```

1. Verifica le autorizzazioni sul file system Amazon FSx collegato al bucket S3.

   ```
   $ sudo lfs df -h /fsx
   UUID                       bytes        Used   Available Use% Mounted on
   3rnxfbmv-MDT0000_UUID       34.4G        6.1M       34.4G   0% /fsx[MDT:0]
   3rnxfbmv-OST0000_UUID        1.1T        4.5M        1.1T   0% /fsx[OST:0]
    
   filesystem_summary:         1.1T        4.5M        1.1T   0% /fsx
    
   $ cd /fsx/s3cptestdir/
   $ ls -ld s3cptestdir/
   drw-rw-r-- 2 500 500 25600 Jan  8 17:33 s3cptestdir/
   
   $ ls -ld s3cptestdir/s3cptest.txt
   -rw-rw-r-- 1 500 500 26 Jan 8 17:33 s3cptestdir/s3cptest.txt
   ```

Sia la `s3cptestdir` directory che il `s3cptest.txt` file hanno le autorizzazioni POSIX importate.