I've written a call to upload a file inside boto3 bucket.
In the call you're required to pass in filename, bucket.
It'll then upload the file to bucket.
However, I'm trying to add versions for each files uploaded to a bucket. So to achieve that I enabled versioning for my bucket; that then gave me versions for files I uploaded to to that bucket.
bucketFile = s3.meta.client.upload_file(filename, str(bucket),filename)
objectSummary = s3.ObjectSummary(bucket,filename)
object = objectSummary.get()
versionID = object.get('VersionId')
versionsAdd = versions(version_url=versionID, filename=filename)
You can use the
ETag associated with an object in Amazon S3 to compare objects and determine whether they are identical. It is an MD5 checksum of the object contents.
If the new version has the same ETag as the previous version, simply skip over it.