lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.7.0 vs lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.7.1

- old
+ new

@@ -310,19 +310,27 @@ credentials_options[:retries] = c.retries if c.retries credentials_options[:ip_address] = c.ip_address if c.ip_address credentials_options[:port] = c.port if c.port credentials_options[:http_open_timeout] = c.http_open_timeout if c.http_open_timeout credentials_options[:http_read_timeout] = c.http_read_timeout if c.http_read_timeout - options[:credentials] = Aws::InstanceProfileCredentials.new(credentials_options) + if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] + options[:credentials] = Aws::ECSCredentials.new(credentials_options) + else + options[:credentials] = Aws::InstanceProfileCredentials.new(credentials_options) + end when @shared_credentials c = @shared_credentials credentials_options[:path] = c.path if c.path credentials_options[:profile_name] = c.profile_name if c.profile_name options[:credentials] = Aws::SharedCredentials.new(credentials_options) when @aws_iam_retries $log.warn("'aws_iam_retries' parameter is deprecated. Use 'instance_profile_credentials' instead") credentials_options[:retries] = @aws_iam_retries - options[:credentials] = Aws::InstanceProfileCredentials.new(credentials_options) + if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"] + options[:credentials] = Aws::ECSCredentials.new(credentials_options) + else + options[:credentials] = Aws::InstanceProfileCredentials.new(credentials_options) + end else # Use default credentials # See http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html end options