New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use aws sdk v2 #85
Use aws sdk v2 #85
Conversation
|
||
config = CONFIG_TIME_SLICE + 'auto_create_bucket true' | ||
d = create_time_sliced_driver(config) | ||
assert_nothing_raised { d.run } | ||
end | ||
|
||
def test_aws_credential_provider_default |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing these tests are intented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
See okkez@05bf971
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ijin Could you also check this PR? |
Sorry, could you rebase the commits? |
AWS -> Aws
Because aws-adk does not have such option.
This is for backward compatibility. If users use fluent-plugin-s3 0.59 or older with default configuration, aws-sdk v1 set "us-east-1" to S3 region automatically. But aws-sdk v2 does not set default value to S3 region, and raise error. See also: https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
Because `Aws::Plugins::S3Md5s::Handler#md5` reads `Tempfile` object.
Because aws-sdk-core calculate md5 digest from tempfile. This change suppresses following warning: [warn]: fluent/output.rb:354:rescue in try_flush: temporarily failed to flush the buffer. next_retry=2015-07-23 11:25:46 +0900 error_class="Aws::S3::Errors::BadDigest" error="The Content-MD5 you specified did not match what we received." plugin_id="object:1e1e370"
This change follows c6e5665.
The following locations will be searched in order for credentials: * :access_key_id, :secret_access_key, and :session_token options * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'] * HOME/.aws/credentials shared credentials file * EC2 instance profile credentials See Plugins::RequestSigner for more details. See also: http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html#initialize-instance_method
aws-sdk v2 does not have API to set credential providers. It is calculated by aws-sdk automatically.
Because flexmock have not been maintained for several years.
Rebased! |
config_param :use_server_side_encryption, :string, :default => nil | ||
config_param :aws_key_id, :string, :default => nil, :secret => true | ||
config_param :aws_sec_key, :string, :default => nil, :secret => true | ||
config_param :aws_iam_retries, :integer, :default => 5 | ||
config_param :s3_bucket, :string | ||
config_param :s3_region, :string, :default => nil | ||
config_param :s3_region, :string, :default => "us-east-1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should keep with nil
. Otherwise, ENV['AWS_REGION']
won't be effective.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When keep nil
, it breaks backward compatibility.
See 4db98de.
Which is preferred?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, then, how about :default => ENV['AWS_REGION'] || 'us-east-1'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented e59099f.
This might break backwards compatibility for some users. A few are attributable to v2 simply not supporting them, but some are from code changes. I do like the idea of replacing flex-mock with rr, though. |
proxy_uri -> http_proxy see http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Client.html#initialize-instance_method
* Aws::AssumeRoleCredentials * Aws::InstanceProfileCrecentials * Aws::SharedCredentials I cannot set some options via `config_param`, so comment out them, for now.
credentials_options[:duration_seconds] = c.duration_seconds if c.duration_seconds | ||
credentials_options[:external_id] = c.external_id if c.external_id | ||
options[:credentials] = Aws::AssumeRoleCredentials.new(credentials_options) | ||
when @instance_profile_credentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using same credentials if user specifies "aws_iam_retries" for backward compatibility?
when @instance_profile_credentials
#...
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea!
I've changed.
This reverts commit 7f783ac. For backward compatibility.
But `aws_iam_retries` is deprecated configuration. This change is only for backward compatibility.
Thanks for applying review! @ijin How about recent changes? I want to merge this PR and release v0.6.0-pre1 for testing. |
LGTM. @okkez Does the required minimum IAM policy change at all? |
@ijin I'm not sure about IAM policy. |
I'm trying to use aws-sdk v2.
TODOs
See also #69 .