lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.5.7 vs lib/fluent/plugin/out_s3.rb in fluent-plugin-s3-0.5.8
- old
+ new
@@ -17,10 +17,11 @@
config_param :path, :string, :default => ""
config_param :use_ssl, :bool, :default => true
config_param :use_server_side_encryption, :string, :default => nil
config_param :aws_key_id, :string, :default => nil
config_param :aws_sec_key, :string, :default => nil
+ config_param :aws_iam_retries, :integer, :default => 5
config_param :s3_bucket, :string
config_param :s3_region, :string, :default => nil
config_param :s3_endpoint, :string, :default => nil
config_param :s3_object_key_format, :string, :default => "%{path}%{time_slice}_%{index}.%{file_extension}"
config_param :store_as, :string, :default => "gzip"
@@ -72,15 +73,13 @@
super
options = {}
if @aws_key_id && @aws_sec_key
options[:access_key_id] = @aws_key_id
options[:secret_access_key] = @aws_sec_key
+ elsif ENV.key? "AWS_ACCESS_KEY_ID"
+ options[:credential_provider] = AWS::Core::CredentialProviders::ENVProvider.new('AWS')
else
- # Avoid missing credentials error from the EC2 metadata service
- # because of temporary loss of network connectivity when using IAM Role.
- # This error is a rare case, so handles it in this plugin.
- # retry retrieving credentials (wait for total approximately 2 min)
- options[:credential_provider] = AWS::Core::CredentialProviders::EC2Provider.new({:retries => 7})
+ options[:credential_provider] = AWS::Core::CredentialProviders::EC2Provider.new({:retries => @aws_iam_retries})
end
options[:region] = @s3_region if @s3_region
options[:s3_endpoint] = @s3_endpoint if @s3_endpoint
options[:proxy_uri] = @proxy_uri if @proxy_uri
options[:use_ssl] = @use_ssl