Skip to main content

Ferramentas Compatíveis com S3

Tabela de Compatibilidade

RecursoFuncionalidadeMGC CLIAWS CLIRClone
BucketCriar
Listar
Deletar
Conversão (público e privado)
Permissividade✅ ➀✅ ➀✅ ➀
URL pública
Versionamento
ObjectUpload
Download
Deletar
Conversão (público e privado)
Permissividade
URL pública
URL Presigned
Versionamento✅ ➁
CategoriaFuncionalidadeLimitação
ObjectVersionamentoRClone não suporta download e exclusão de versões de objetos.

Para mais informações sobre as limitações, consulte este documento.

SímboloSignificado
Suportado
Não suportado

Configuração das Ferramentas

AWS CLI

  1. Instalação: Siga as instruções fornecidas na documentação oficial da AWS.

  2. Configuração da API Key:

    1. Execute o comando:
    aws configure
    1. Insira as informações conforme solicitado:
    AWS Access Key ID [None]: <ID>
    AWS Secret Access Key [None]: <Secret>
    Default region name [None]: <Region>
    Default output format [None]:<Enter>
    • Substitua <ID> e <Secret> pelas informações da API Key gerada.
    • Substitua <Region> por uma de Nossas regiões.
  3. Configuração do Endpoint URL:

    1. Abra o arquivo ~/.aws/config com um editor de sua preferência.
    2. Encontre a seção [default] e adicione a configuração do endpoint_url, por exemplo:
    [default]
    region = region
    endpoint_url = endpoint_url
    region = region
    endpoint_url = endpoint_url
    1. Salve o arquivo e teste a configuração.

RClone

  1. Instalação: Siga as instruções na documentação oficial do Rclone.

  2. Configuração da API Key:

    1. Execute o comando:
    rclone config
    1. Siga as instruções para criar um novo remote:
    Current Remotes: <n>
    Enter name for new remote: <RemoteName>
    Type of storage configure: <s3>
    Choose your S3 provider: <Magalu>
    Option env_auth: <false>
    access_key_id: <ID>
    secret_access_key: <Secret>
    endpoint: <1 or 2>
    endpoint: <Enter>
    Option location_constrain: <Enter>
    Option ACL: <Enter>
    Edit advanced config: <n>
    Configuration Complete: <Enter>

Onde <ID> e <Secret> são as informações da API Key gerada.

Compatibilidade de SDKs

O bucket da Magalu Cloud é compatível com SDKs que utilizam o protocolo S3, assim como o AWS CLI. Isso facilita a migração para a Cloud da Magalu. Abaixo está um exemplo de uso com o SDK Boto3 em Python:

import boto3

endpoint_url = "<Region URL>" # Substitua pela URL da região
aws_access_key_id = '<Magalu API-Key>'
aws_secret_access_key = '<Magalu API-Secret>'
bucket_name = 'nome-do-bucket'

client = boto3.client('s3',
endpoint_url=endpoint_url,
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key)

def list_buckets():
response = client.list_buckets()
buckets = [bucket['Name'] for bucket in response['Buckets']]
print("Listando buckets...")
for bucket in buckets:
print(bucket)

def create_bucket():
print(f"Criando bucket {bucket_name}...")
client.create_bucket(Bucket=bucket_name)

def upload_file():
print("Fazendo upload do arquivo...")
local_file_path = 'C:/PATH/EXAMPLE/Roadmap.html'
s3_file_key = 'example'
client.upload_file(local_file_path, bucket_name, s3_file_key)