'How to manage s3 bucket for files and app?

Can someone answer my these two questions plz

  1. Do I need to create seprate s3 buckets like one for react app and other for Images and files ?

  2. When I deploy my app like this:

    new s3Deployment.BucketDeployment(this, "deployStaticWebsite", {
     sources: [s3Deployment.Source.asset("../frontEnd/build")],
     destinationBucket: myBucket,
     distribution: distribution,
     // destinationKeyPrefix:"build",
     });
    

It replaces all the content of the bucket on every deploy. what is the best solution to avoid this.



Solution 1:[1]

Yes you should have a separate bucket for website deployment and data storage. The bucket you use for website will usually be a public one (unless you are using it with cloudfront).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ninad Gaikwad