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.