I can successfully upload a file to S3 using both generate_presigned_url() and generate_presigned_post() without specifying a storage class.
As soon as I try to specify a storage class I receive an error.
import boto3
from botocore.client import Config
s3_client = boto3.client(service_name='s3',config=Config(signature_version='s3v4'))
s3_client.generate_presigned_url(ClientMethod='put_object',Params={'Bucket':bucket,'Key':'test.txt', 'StorageClass':'INTELLIGENT_TIERING'})
fails with
The request signature we calculated does not match the signature you provided. Check your key and signing method.
import boto3
from botocore.client import Config
s3_client = boto3.client(service_name='s3',config=Config(signature_version='s3v4')
parts=s3_client.generate_presigned_post(Bucket=bucket,Key='test.txt', Fields={'StorageClass':'INTELLIGENT_TIERING'})
files = {'file':open('test.txt')}
response=requests.post(parts['url'], data=parts['fields'], files=files)
fails with
Invalid according to Policy: Extra input fields: StorageClass
I've tried the latter approach with "Storage-Class", "x-amz-storage-class", and a variety of different key names with the same result.
Where am I going wrong?
UPDATE: more info
I don't believe I have any permission issues since this works:
s3_client.put_object(Bucket=bucket,Key='test.txt', StorageClass='INTELLIGENT_TIERING', Body=binary_data)
Also, I get the same signature mismatch error noted above with generate_presigned_url() if I replace INTELLIGENT_TIERING with STANDARD. Seems to not be an issue of the new class being unsupported.