Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (12.9k points)

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.
closed

1 Answer

+2 votes
by (18.2k points)
selected by
 
Best answer

To replace an old file in S3 bucket with a new file, you can just upload your new file on top of your old file. Your new file will overwrite the existing one.

So, if your old file exists in s3://fooname/barname.bin you can use the following command to replace it with a new file.

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

Learn more about AWS by going through AWS course and master this trending technology.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

Browse Categories

...