Is it possible to determine whether or not an S3 object was created or updated when using boto3?
When using boto3.client('s3').put_object() to create or update S3 objects, the underlying PutObject API action doesn't differentiate between creating and updating objects, so ResponseMetadata.HTTPStatusCode is always 200.
There is no post_object() method for boto3.client('s3'), nor is there a post method for boto3.resource('s3').object(). In fact, it doesn't appear that there is a PostObject API action anyway.
import boto3
import base
import base64
client = boto3.client('s3')
body = 'Hello World!'
response = client.put_object(
Bucket='my-bucket',
Key='my-key.json',
Body=body.encode('utf-8'))
print('S3 object successfully created. Or was it updated????')