1

I'm currently working on a new Craft CMS website for my company. We're using Elastic Beanstalk for hosting, which means that saving assets to file on the server isn't really viable- they get overwritten by code deployments- so I'm planning to have them saved to S3.

However when I or other developers are working on the site locally, uploading to S3 is both unnecessary and difficult (the company handles a lot of sensitive data so individual access to any of our AWS services is heavily ring-fenced). It would be preferable in development to just upload images to file locally and keep them out of version control.

Ideally I'd like to be able to change the root asset location depending on the environment. I've done similar things in Rails and Express apps, but am very new to Craft and PHP in general and am not sure where to begin. The official AWS integration seems to assume that you want everything going into S3 all the time. Does anyone have any experience of using different upload locations for different environments?

1

AFAIK, you can't change the type of your volume based on your environment. But if having a separate S3 account/bucket for dev could work for you, you can configure this with a volume.php config file. Check out this section in the docs about configuration for the gist on how to use it, and the section about per environment configuration in the readme for the AWS-S3 plugin for the specifics for that type of volume.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.