Thank you for reading this post, don't forget to subscribe!
смотрим текущий storageclass
aws s3api list-objects --bucket testbucket
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
{ "Contents": [ { "Key": "css/base.css", "LastModified": "2022-04-11T09:51:47+00:00", "ETag": "\"305f289563369e66c5819bff7e81cd17\"", "Size": 490, "StorageClass": "STANDARD", "Owner": { "DisplayName": "test-v2", "ID": "39ab5f42eef553d0d5d6dfa344fdf88fb60f6928bea0ca14ec4177002c55c220" } }, { "Key": "css/media-queries.css", "LastModified": "2022-04-11T09:51:47+00:00", "ETag": "\"6a26eb490042fd476a4135b2ac4255a8\"", "Size": 506, "StorageClass": "STANDARD", "Owner": { "DisplayName": "test-v2", "ID": "39ab5f42eef553d0d5d6dfa344fdf88fb60f6928bea0ca14ec4177002c55c220" } }, { "Key": "css/styles.css", "LastModified": "2022-04-11T09:51:47+00:00", "ETag": "\"99a046ba1b111d360621abec49723dab\"", "Size": 1242, "StorageClass": "STANDARD", "Owner": { "DisplayName": "test-v2", "ID": "39ab5f42eef553d0d5d6dfa344fdf88fb60f6928bea0ca14ec4177002c55c220" } }, { "Key": "images/fire_image.svg", "LastModified": "2022-04-11T09:51:47+00:00", "ETag": "\"e1b2ed701dcb26bd3532dad9a38a50d8\"", "Size": 1930, "StorageClass": "STANDARD", "Owner": { "DisplayName": "test-v2", "ID": "39ab5f42eef553d0d5d6dfa344fdf88fb60f6928bea0ca14ec4177002c55c220" } }, |
можем менять тип для каждого объекта через панель:
Amazon S3 - Buckets- testbucket -index.html - Storage class - Edit
выбираем нужный тип
сохраняем и ещё раз проверяем вывод:
aws s3api list-objects --bucket testbucket
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
{ { "Key": "images/title_image.svg", "LastModified": "2022-04-11T09:51:47+00:00", "ETag": "\"2c35785bf882e0a64b059dd3a00805ca\"", "Size": 7657, "StorageClass": "STANDARD", "Owner": { "DisplayName": "test-v2", "ID": "39ab5f42eef553d0d5d6dfa344fdf88fb60f6928bea0ca14ec4177002c55c220" } }, { "Key": "index.html", "LastModified": "2022-08-02T06:54:05+00:00", "ETag": "\"b7804d1eea6ffc6eef8a906706969893\"", "Size": 1592, "StorageClass": "GLACIER_IR", "Owner": { "DisplayName": "test-v2", "ID": "39ab5f42eef553d0d5d6dfa344fdf88fb60f6928bea0ca14ec4177002c55c220" } } ] } |
видим что поменялся Storage class со STANDARD на GLACIER_IR всё теперь мы знаем нужное нам имя и можем менять Storage class для всех объектов:
aws s3 cp s3://testbucket s3://testbucket --recursive --storage-class GLACIER_IR
получаем ошибку:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
usage: aws [options] <command> <subcommand> [<subcommand> …] [parameters] To see help text, you can run: aws help aws <command> help aws <command> <subcommand> help aws: error: argument --storage-class: Invalid choice, valid choices are: STANDARD | REDUCED_REDUNDANCY STANDARD_IA | ONEZONE_IA INTELLIGENT_TIERING | GLACIER DEEP_ARCHIVE Invalid choice: 'GLACIER_IR', maybe you meant: * GLACIER |
не получилось перевести в glacier_ir поэтому перевёл в обычный Glacier
aws s3 cp s3://testbucket s3://testbucket --recursive --storage-class GLACIER