AWS CLI
AWS CLI omogućava upravljanje HostArena S3 Storage servisom direktno iz komandne linije. Pomoću njega možete kreirati skripte, automatizovati bekape i upravljati fajlovima.
Šta je potrebno?
Pripremite sledeće podatke iz korisničkog panela:
-
Endpoint
-
Access Key
-
Secret Key
-
Naziv Bucket-a
Primer:
| Polje | Primer |
|---|---|
| Endpoint | https://username.s3.hostarena.rs |
| Bucket | username |
| Access Key | Dostupan u panelu |
| Secret Key | Dostupan u panelu |
Instalacija
Preuzmite i instalirajte AWS CLI za vaš operativni sistem.
Nakon instalacije proverite verziju:
aws --version
Konfiguracija
Pokrenite:
aws configure
Unesite podatke:
AWS Access Key ID:
AWS Secret Access Key:
Default region name: us-east-1
Default output format: json
Region nije bitan za HostArena S3 Storage, ali AWS CLI zahteva da bude unet.
Prikaz Bucket-a
aws s3 ls \
--endpoint-url=https://username.s3.hostarena.rs
Prikaz sadržaja Bucket-a
aws s3 ls s3://username \
--endpoint-url=https://username.s3.hostarena.rs
Upload fajla
aws s3 cp backup.zip s3://username \
--endpoint-url=https://username.s3.hostarena.rs
Upload direktorijuma
aws s3 cp ./backup s3://username \
--recursive \
--endpoint-url=https://username.s3.hostarena.rs
Preuzimanje fajla
aws s3 cp s3://username/backup.zip . \
--endpoint-url=https://username.s3.hostarena.rs
Preuzimanje direktorijuma
aws s3 cp s3://username ./backup \
--recursive \
--endpoint-url=https://username.s3.hostarena.rs
Sinhronizacija lokalnog direktorijuma
aws s3 sync ./backup s3://username \
--endpoint-url=https://username.s3.hostarena.rs
Sinhronizacija sa S3 na računar
aws s3 sync s3://username ./backup \
--endpoint-url=https://username.s3.hostarena.rs
Brisanje fajla
aws s3 rm s3://username/backup.zip \
--endpoint-url=https://username.s3.hostarena.rs
Brisanje direktorijuma
aws s3 rm s3://username/stari-backup \
--recursive \
--endpoint-url=https://username.s3.hostarena.rs
Najčešći problemi
InvalidAccessKeyId
Proverite da li je Access Key ispravno unet.
SignatureDoesNotMatch
Proverite Secret Key i Endpoint.
Could not connect to the endpoint URL
Proverite da li koristite:
https://username.s3.hostarena.rs
i da li je internet konekcija dostupna.
