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, 2022 in Others by Edureka
• 13,690 points
9,019 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, 2022 by gaurav
• 23,260 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, 2022 in Others by gaurav
• 23,260 points
1,441 views
0 votes
0 answers

How to add S3 BucketPolicy with AWS CDK?

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

Mar 11, 2022 in Others by Edureka
• 13,690 points
1,108 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, 2022 in Others by gaurav
• 23,260 points
2,181 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, 2022 in Others by gaurav
• 23,260 points
4,801 views
0 votes
1 answer

How to automate AWS Elastic Transcoder Jobs for s3 buckets?

This article will walk you through uploading ...READ MORE

answered Mar 24, 2022 in Others by gaurav
• 23,260 points
866 views
0 votes
1 answer

why aws s3 transfer acceleration is not working?

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

answered Mar 24, 2022 in Others by gaurav
• 23,260 points
1,297 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, 2022 in Others by gaurav
• 23,260 points
924 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, 2022 in Others by gaurav
• 23,260 points
9,773 views
0 votes
1 answer

How to add S3 BucketPolicy with AWS CDK?

In AWS CDK, there are two ways ...READ MORE

answered Mar 9, 2022 in Others by gaurav
• 23,260 points
3,280 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP