New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursively change storage class on bucket #2056

Closed
kaihendry opened this Issue Jul 10, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@kaihendry

kaihendry commented Jul 10, 2016

How does one recursively change all objects on a bucket to STANDARD_IA with aws s3?

http://docs.aws.amazon.com/AmazonS3/latest/dev/ChgStoClsOfObj.html

Bonus: A way of defining a default storage class in ~/.aws/config

@kyleknap

This comment has been minimized.

Member

kyleknap commented Jul 12, 2016

You can do it by running this command:

$ aws s3 cp s3://knapp-standard-ia s3://knapp-standard-ia --recursive --storage-class STANDARD_IA
copy: s3://knapp-standard-ia/foo.py to s3://knapp-standard-ia/foo.py
copy: s3://knapp-standard-ia/100MB to s3://knapp-standard-ia/100MB

And then if you check the contents, the class should be STANDARD_IA:

$ aws s3api list-objects --bucket knapp-standard-ia
{
    "Contents": [
        {
            "LastModified": "2016-07-12T19:37:40.000Z", 
            "ETag": "\"0c4af570340e15f2be9924e70bc34257-13\"", 
            "StorageClass": "STANDARD_IA", 
            "Key": "100MB", 
            "Owner": {
                "DisplayName": "kylekaws", 
                "ID": "876e6c081ece589308db3ea341721492c49ad27397678f075c6deeeb6935a80f"
            }, 
            "Size": 104857600
        }, 
        {
            "LastModified": "2016-07-12T19:37:41.000Z", 
            "ETag": "\"d9ccfaeb76cd014d2551753ac45b8b98\"", 
            "StorageClass": "STANDARD_IA", 
            "Key": "foo.py", 
            "Owner": {
                "DisplayName": "kylekaws", 
                "ID": "876e6c081ece589308db3ea341721492c49ad27397678f075c6deeeb6935a80f"
            }, 
            "Size": 825
        }
    ]
}

I am not sure storage class is something we would want to define in the config file. It is pretty specific. It would need to be something more general like setting default parameters.

Let us know if that helps.

@kaihendry

This comment has been minimized.

kaihendry commented Jul 13, 2016

Thanks Kyle, I hope that goes into the man page / documentation as an example.

@kaihendry kaihendry closed this Jul 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment