To calculate the total size of all objects contained in a S3 bucket, use the following command:
ls my_bucket_name -s -sum
where: my_bucket_name is the name of your bucket -s is used to include all subfolders (e.g. recursive) -sum is used to show just a summary without listing all objects.