Halo, kalau kamu merasa tulisan saya ngebantu kamu, kamu bisa ucapkan terima kasih lewat saweria.

If you feel this website help you, you can donate at saweria.



How To

Calculate Using s3cmd

  1. Install s3cmd apt install s3cmd

  2. Then configure it s3cmd --configure

  3. To check the bucket total size, use s3cmd du -H s3://bucket-name

  4. If your bucket size has a lot of data and you get an error “Temporary error in name resolution,” you can try using s5cmd

Calculate Using s5cmd

What is s5cmd?

s5cmd is a very fast S3 and local filesystem execution tool. It comes with support for a multitude of operations, including tab completion and wildcard support for files, which can be very handy for your object storage workflow when working with a large number of files.

For AWS S3/DigitalOcean Spaces file manipulation, I use s5cmd because it is more handy and faster than s3cmd.

  1. Install s5cmd:

    mkdir /tmp/s5cmd
    curl -L -o /tmp/s5cmd/s5cmd.tar.gz https://github.com/peak/s5cmd/releases/download/v2.2.2/s5cmd_2.2.2_Linux-64bit.tar.gz
    cd /tmp/s5cmd
    tar -xvf s5cmd.tar.gz
    sudo mv s5cmd /usr/bin/
    
  2. Setup S3 credentials for s5cmd:

    mkdir ~/.aws/
    
    vim ~/.aws/credentials
    

    Fill it with:

    [default]
    aws_access_key_id = accesskey
    aws_secret_access_key = secretkey
    

    Then configure its permissions:

    chmod -R 400 ~/.aws
    
  3. To calculate the bucket size, use s5cmd du -H "s3://bucket-name/".

    For DigitalOcean Spaces, use s5cmd --endpoint-url https://sgp1.digitaloceanspaces.com du -H s3://bucket-name