将AWS SDK部署到实时服务器时出现问题

时间:2020-09-05 11:40:02

标签: laravel amazon-web-services amazon-s3

您好,我想将laravel应用程序部署到实时AWS服务器中,但是当我尝试进行作曲家安装时,得到此错误,我在本地环境btw中没有错误,无法部署到s3等中,我didint在线发现了错误

我的.env文件看起来像这样

 AWS_ACCESS_KEY_ID=*******
    AWS_SECRET_ACCESS_KEY=********
    REGION= eu-west-1
    B1_BUCKET_NAME=b1-test-s3





    539| 
     540|             // Check region is a valid host label when it is being used to
     541|             // generate an endpoint
     542|             if (!self::isValidRegion($args['region'])) {
   > 543|                 throw new InvalidRegionException('Region must be a valid RFC'
     544|                     . ' host label.');
     545|             }
     546| 
     547|             // Invoke the endpoint provider and throw if it does not resolve.
 
   Exception trace:
 
   1   Aws\ClientResolver::_apply_endpoint_provider(Object(Aws\Endpoint\Partition), Object(Aws\HandlerList))
       /home/vsts/work/1/s/vendor/aws/aws-sdk-php/src/ClientResolver.php:323
 
   2   Aws\ClientResolver::resolve(Object(Aws\HandlerList))
       /home/vsts/work/1/s/vendor/aws/aws-sdk-php/src/AwsClient.php:199
 
   Please use the argument -v to see more details.

1 个答案:

答案 0 :(得分:1)

对于任何在u部署到AWS服务中时遇到此问题的人,在从aws / aws-sdk-php软件包发布的配置文件中都有名为aws.config的配置文件,您需要在其中编辑默认区域,如果您不要编辑它,而是尝试仅在env文件中对其进行编辑

'region' => env('AWS_REGION', 'eu-west-1'), 

如果第二个参数为null,那么它将无法正常工作