A maneira mais fácil e barata de manter os dados do seu servidor seguro é usar o s3cmd, da Amazon.
Para começar, crie sua conta, e siga as instruções abaixo:
Para Centos:
yum install s3cmd
Para Ubuntu
apt-get install s3cmd
Depois de pegar suas credenciais e chaves, digite:
s3cmd --configure
Enter new values or accept defaults in brackets with Enter. Refer to user manual for detailed description of all options. Access key and Secret key are your identifiers for Amazon S3 Access Key: xxxxxxxxxxxxxxxxxxxxxx Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Encryption password is used to protect your files from reading by unauthorized persons while in transfer to S3 Encryption password: xxxxxxxxxx Path to GPG program [/usr/bin/gpg]: When using secure HTTPS protocol all communication with Amazon S3 servers is protected from 3rd party eavesdropping. This method is slower than plain HTTP and can't be used if you're behind a proxy Use HTTPS protocol [No]: Yes New settings: Access Key: xxxxxxxxxxxxxxxxxxxxxx Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Encryption password: xxxxxxxxxx Path to GPG program: /usr/bin/gpg Use HTTPS protocol: True HTTP Proxy server name: HTTP Proxy server port: 0 Test access with supplied credentials? [Y/n] Y Please wait, attempting to list all buckets... Success. Your access key and secret key worked fine :-) Now verifying that encryption works... Success. Encryption and decryption worked fine :-) Save settings? [y/N] y Configuration saved to '/root/.s3cfg'
Pronto! Tudo instalado. Agora alguns comandos úteis:
Listar buckets:
s3cmd ls
Criar um bucket chamado teste:
s3cmd md s3://teste
Fazer upload de um arquivo para um bucket:
s3cmd put teste.txt s3://teste
Fazer upload de diretório para bucket:
s3cmd -r put dirteste s3://teste
Não coloque / no final do nome do seu diretório, se colocar, as subpastas não sobem, mesmo usando -r para recursivo
Listar conteúdo de um bucket
s3cmd ls s3://teste
Baixar arquivo de um bucket:
s3cmd get s3://teste/teste.txt
Remover arquivos ou diretórios de um bucket:
s3cmd del s3://teste/teste.txt
s3cmd del s3://teste/teste
Sincronizar Bucket:
s3cmd sync /home/teste s3://teste
usando -p ou –preserve você manter as propriedades dos arquivos existentes
s3cmd sync /home/teste --preserve s3://teste
usando –skip-existing você pula os arquivos que já estão no bucket:
s3cmd sync /home/teste --skip-existing s3://teste
usando –delete-removed você exclui os arquivos do bucket que foram removidos do diretório local:
s3cmd sync /home/teste --delete-removed s3://teste
Você também pode sincronizar o diretório local de acordo com o conteúdo do bucket, é só inverter a sintaxe:
s3cmd sync s3://teste /home/teste
todas as opções citadas acima também podem ser utilizadas nessa operação.
Remover um bucket:
s3cmd rb s3://teste
Uma resposta em “Como instalar s3cmd no Linux e gerenciar seus buckets”
[…] Como gerenciar seus Buckets. […]