尝试使用gaufrette上传到S3时出错

时间:2014-04-26 06:08:52

标签: symfony amazon-web-services amazon-s3 symfony-2.4 gaufrette

我正在尝试使用the KNPLabs gaufrette bundle将图像文件上传到S3。当我从S3调试响应时,我收到以下错误:

The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

images.mynamespace.com.s3.amazonaws.com

我已经尝试将base_url参数设置为该端点但仍然得到相同的错误。关于SO的其他问题建议设置我也尝试过的区域。

我要上传的广告位于欧洲西部地区(爱尔兰)。无论我尝试什么配置,gaufrette似乎仍然试图使用s3.amazonaws.com

如何正确配置gaufrette?

config.yml:

knp_gaufrette:
    adapters:
        image_storage:
            amazon_s3:
                amazon_s3_id: mynamespace_admin.amazon_s3
                bucket_name:  %amazon_s3_bucket_name%
                create:       false
                options:
                    create:     true
                    directory: 'dirname'
                    region:     eu-west-1


    filesystems:
        image_storage:
            adapter:    image_storage
            alias:      image_storage_filesystem

1 个答案:

答案 0 :(得分:7)

I needed to set region to s3-eu-west-1.amazonaws.com

knp_gaufrette:
    adapters:
        image_storage:
            amazon_s3:
                amazon_s3_id: mynamespace_admin.amazon_s3
                bucket_name:  %amazon_s3_bucket_name%
                create:       false
                options:
                    create:     true
                    directory: 'dirname'
                    region:     s3-eu-west-1.amazonaws.com