Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services [fog][警告]无法获取凭据:没有到主机的路由-连接(2)-(错误号::EHOSTUNREACH)_Amazon Web Services_Amazon S3_Carrierwave_Amazon Iam - Fatal编程技术网

Amazon web services [fog][警告]无法获取凭据:没有到主机的路由-连接(2)-(错误号::EHOSTUNREACH)

Amazon web services [fog][警告]无法获取凭据:没有到主机的路由-连接(2)-(错误号::EHOSTUNREACH),amazon-web-services,amazon-s3,carrierwave,amazon-iam,Amazon Web Services,Amazon S3,Carrierwave,Amazon Iam,嗨,我在RubyonRails中用AmazonS3配置了carrierwave。在控制台中显示此消息 [fog][警告]无法获取凭据:没有到主机的路由-连接(2)-(错误号::EHOSTUNREACH) 我的应用程序加载滞后,但当我试图上传文件时,应用程序挂起,但文件在bucket中上传正确 这是我的配置s3。初始化器 CarrierWave.configure do |config| config.fog_provider = 'fog/aws'

嗨,我在RubyonRails中用AmazonS3配置了carrierwave。在控制台中显示此消息

[fog][警告]无法获取凭据:没有到主机的路由-连接(2)-(错误号::EHOSTUNREACH)

我的应用程序加载滞后,但当我试图上传文件时,应用程序挂起,但文件在bucket中上传正确

这是我的配置s3。初始化器

CarrierWave.configure do |config|
  config.fog_provider = 'fog/aws'                        # required
  config.fog_credentials = {
    provider:              'AWS',                        # required
    aws_access_key_id:     'AK******',                        # required unless using use_iam_profile
    aws_secret_access_key: 'rKI********',                        # required unless using use_iam_profile
    use_iam_profile:       true,                         # optional, defaults to false
    region:                'us-east-2'                  # optional, defaults to 'us-east-1'

  }
  config.fog_directory  = '<name of bucked>'                                      # required
  config.fog_public     = false                                                 # optional, defaults to true
  config.fog_attributes = { cache_control: "public, max-age=#{365.days.to_i}" } # optional, defaults to {}
end
CarrierWave.configure do|config|
config.fog_provider='fog/aws'#必需
config.fog\u凭据={
提供程序:“AWS”,必填项
aws_access_key_id:“AK*******”,需要,除非使用“使用iam_配置文件”
aws_secret_access_key:'rKI********',#必需,除非使用_iam_profile
use_iam_profile:true,#可选,默认为false
地区:“us-east-2”可选,默认为“us-east-1”
}
config.fog_目录=''必需
config.fog_public=false#可选,默认为true
config.fog_attributes={cache_control:“public,max age={365.days.to_i}}}可选,默认为{}
结束

如果我将param use_iam_profile设置为false,程序将工作,但我现在不知道为什么param use_iam_profile true不工作