Reputation: 571
I want to change the S3 bucket to have default storage class of Infrequent Access.
So if I upload file to the bucket, it should directly go to Infrequent Access storage.
I don't want to use the Lifecycle
Upvotes: 17
Views: 12109
Reputation: 2195
You can now create a bucket policy with a specific storage class now
This way any attempt to upload object with prohibited classes would fail.
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::123456789012:user/Dave"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::DOC-EXAMPLE-BUCKET1/*",
"Condition": {
"StringEquals": {
"s3:x-amz-storage-class": [
"STANDARD_IA"
]
}
}
}
]
}
Upvotes: 0
Reputation: 571
I found the answer myself.
Using cli-
aws s3 cp glacier.png s3://my-lambada-example-thumbnails/ --storage-class STANDARD_IA
So by using --storage-class
we could specify the storage class.
Also when uploading from AWS console we get to specify the storage class.
Those who are using AWS File Gateway and want to change Storage class from S3 standard to IA can change as shown below.
Upvotes: 14
Reputation: 269540
There is no concept of a default storage class for an Amazon S3 bucket.
The storage class is specific to the object and can be specified when the object is created in the bucket.
You will need to change your upload process to specify the storage class at the time of object creation.
You can use the lifecycle rules to later change storage classes based upon the age of the object, which is as close as you'll get to a "default storage class".
Upvotes: 19