Reputation: 6189
having a development, maybe a staging and a production environment can wreak havoc to files stored on S3, possibly creating overwrites.
Adding a timestamp to the filename is a possibility, but the instance considered is not comtemplating that route. Rather, the goal is to append a form of suffix to distinguish development and staging records (and associated files) so that all may be saved and served.
What is the wisest way to accomplish this?
Upvotes: 0
Views: 31
Reputation: 4364
The easiest option is to just use different buckets for different environments. Think app-development
and app-production
. Ideally, restrictions are put on the different buckets and access is limited to certain keys. This can ensure that for example only the production server can destroy objects in the production bucket.
Which bucket to use can be set either through an environment variable, an initializer or per environment.
One step further would be to use different AWS accounts for different environments, but whether or not that makes sense depends on your organization and the resources you use on AWS. I would say its overkill for just S3. If you are interested in this, though, this is a short article that explains the concept and the reasoning behind it: Separate AWS Production and Development Accounts
Upvotes: 2