aws s3 replace file atomically

0 votes

Environment

  • I copied a file, ./barname.bin, to s3, using the command aws s3 cp ./barname.bin s3://fooname/barname.bin

  • I have a different file, ./barname.1.bin that I want to upload in place of that file


How can I upload and replace (overwrite) the file at s3://fooname/barname.bin with ./barname.1.bin?

Goals:

  • Don't change the s3 url used to access the file (new file should also be available at s3://fooname/barname.bin).
  • zero/minimum 'downtime'/unavailability of the s3 link.

Mar 21 in Others by Edureka
• 9,700 points
87 views

1 answer to this question.

0 votes

Simply upload your new file on top of your old file to replace an old file in an S3 bucket. The existing file will be overwritten by your new file.

If your old file is located at s3:/fooname/barname.bin, you can replace it with a new one with the following command.

aws s3 cp ./barname.1.bin s3://fooname/barname.bin

answered Mar 24 by Edureka
• 8,820 points

Related Questions In Others

+1 vote
0 answers
0 votes
1 answer

What does it mean when owner is None on an AWS S3 object?

S3 Object Ownership is an Amazon S3 ...READ MORE

answered Mar 15 in Others by Edureka
• 8,820 points
117 views
0 votes
0 answers

How to add S3 BucketPolicy with AWS CDK?

I wanna translate this CloudFormation piece into ...READ MORE

Mar 11 in Others by Edureka
• 9,700 points
132 views
0 votes
1 answer

How to use AWS S3 CLI to dump files to stdout in BASH?

All file objects must have their contents ...READ MORE

answered Mar 24 in Others by Edureka
• 8,820 points
183 views
0 votes
1 answer

Get last modified object from S3 using AWS CLI

With aws s3 ls $BUCKET —recursive, you ...READ MORE

answered Mar 24 in Others by Edureka
• 8,820 points
85 views
0 votes
1 answer
0 votes
1 answer

why aws s3 transfer acceleration is not working?

Essentially, rather than travelling the Internet to ...READ MORE

answered Mar 24 in Others by Edureka
• 8,820 points
51 views
0 votes
1 answer

why aws s3 transfer acceleration is not working?

Amazon S3 Transfer Acceleration is a bucket-level ...READ MORE

answered Mar 24 in Others by Edureka
• 8,820 points
43 views
0 votes
1 answer

NodeJS Amazon AWS S3 getObject how to send file in API response to download

Server Side const aws = require('aws-sdk'); router.get('/getfilefroms3', async (req, ...READ MORE

answered Mar 24 in Others by Edureka
• 8,820 points
135 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP