How to specify the folder for @strapi/provider-upload-aws-s3 plugin?

System Information

@strapi/strapi”: “4.12.0”,

Hi I am using
@strapi/provider-upload-aws-s3”: “^4.12.0”,

It works great as described here Set up Amazon S3 Upload Provider Plugin for Your Strapi App but always uploads in the ROOT OF the bucket.

Is there any way to specify a folder to use ? so it uploads for example at bucket/strapiuploads/* ?

I want to re-use one existing bucket and just create a folder there instead of creating a totally new bucket


After debugging the js of the plugin I found that you can specify rootPath in the config like below:

        provider: 'aws-s3',
        providerOptions: {
            rootPath: 'strapi',
            accessKeyId: env('AWS_S3_KEY'),
            secretAccessKey: env('AWS_S3_SECRET'),
            region: env('AWS_S3_REGION'),
            params: {
                Bucket: env('AWS_S3_BUCKET'),
        actionOptions: {
            upload: {},
            uploadStream: {},
            delete: {},

After the rootPath is specified the plugin will work only with the strapi folder in your specified bucket


Thanks that was helpful.
Was unable to find that in the plugin docs.