Let's assume I uploaded a file to S3:
aws s3 cp dictionaries.xcu s3://cf-templates-us-east-1/
I need to update that file only if it does not already exist. In that case I use --if-none-match parameter as shown below:
aws s3api put-object --bucket cf-templates-us-east-1 --key dictionaries.xcu --body dictionaries.xcu --if-none-match "*"
Returns "An error occurred (PreconditionFailed)"
This will help me while trying to upload a large file again.
_____
Following features are available for S3 Express One Zone:
1) In directory buckets, clients can perform conditional delete checks on an object’s last modified time, size, and Etag using the x-amz-if-match-last-modified-time, x-amz-if-match-size, and HTTP if-match headers.
2) Append data to a file:
aws s3api put-object --bucket cf-templates-us-east-1 --key dictionaries.xcu --body dictionaries.xcu --write-offset-bytes file001.bin
Or use python:
s3.put_object(Bucket='amzn-s3-demo-bucket--use2-az2--x-s3', Key='2024-11-05-sdk-test', Body=b'123456789', WriteOffsetBytes=9)
It can not replace your database or Messaging Queues because only a few thousand updates are possible for each object.
3) You can configure S3 Lifecycle rules for S3 Express One Zone to expire objects on your behalf. For example, you can create an S3 Lifecycle rule that expires all objects smaller than 512 KB after 3 days and another rule that expires all objects in a prefix after 10 days.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.