{"action":"created","issue":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/1082","repository_url":"https://api.github.com/repos/rusoto/rusoto","labels_url":"https://api.github.com/repos/rusoto/rusoto/issues/1082/labels{/name}","comments_url":"https://api.github.com/repos/rusoto/rusoto/issues/1082/comments","events_url":"https://api.github.com/repos/rusoto/rusoto/issues/1082/events","html_url":"https://github.com/rusoto/rusoto/issues/1082","id":340485642,"node_id":"MDU6SXNzdWUzNDA0ODU2NDI=","number":1082,"title":"Default credential provider timeout is too long","user":{"login":"softprops","id":2242,"node_id":"MDQ6VXNlcjIyNDI=","avatar_url":"https://avatars3.githubusercontent.com/u/2242?v=4","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"labels":[{"id":236362905,"node_id":"MDU6TGFiZWwyMzYzNjI5MDU=","url":"https://api.github.com/repos/rusoto/rusoto/labels/help%20wanted","name":"help wanted","color":"159818","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-07-12T04:31:13Z","updated_at":"2018-08-30T03:18:19Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"The easiest way to get started with rusoto in 0.32 is to use the generated client simple flavor constructors. These configure clients with default  credential provider which has a 30 second timeout when credentials cannot be resolved. This can be an awkward ux for simple cli apps.\r\n\r\nThe underlying credential chain impl has a set timeout method but it's kind of awkward to figure out how to construct one and configure a client to use it.\r\n\r\nCan you provide a recommendation for how to set up a client with a shorter than 30 second timeout? Alternatively it seems like it would be a better default to fail fast then extend the time out for really network prone use cases."},"comment":{"url":"https://api.github.com/repos/rusoto/rusoto/issues/comments/417176666","html_url":"https://github.com/rusoto/rusoto/issues/1082#issuecomment-417176666","issue_url":"https://api.github.com/repos/rusoto/rusoto/issues/1082","id":417176666,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNzE3NjY2Ng==","user":{"login":"softprops","id":2242,"node_id":"MDQ6VXNlcjIyNDI=","avatar_url":"https://avatars3.githubusercontent.com/u/2242?v=4","gravatar_id":"","url":"https://api.github.com/users/softprops","html_url":"https://github.com/softprops","followers_url":"https://api.github.com/users/softprops/followers","following_url":"https://api.github.com/users/softprops/following{/other_user}","gists_url":"https://api.github.com/users/softprops/gists{/gist_id}","starred_url":"https://api.github.com/users/softprops/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/softprops/subscriptions","organizations_url":"https://api.github.com/users/softprops/orgs","repos_url":"https://api.github.com/users/softprops/repos","events_url":"https://api.github.com/users/softprops/events{/privacy}","received_events_url":"https://api.github.com/users/softprops/received_events","type":"User","site_admin":false},"created_at":"2018-08-30T03:18:19Z","updated_at":"2018-08-30T03:18:19Z","author_association":"CONTRIBUTOR","body":"Okay I spent a little more time looking at this. Here's my work around\r\n\r\nassuming any client crate `Foo` you can add a dependency on the `rusoto_credential` crate and `rusoto_core` and do the following.\r\n\r\n```rust\r\nuse std::time::Duration;\r\n\r\nuse rusoto_core::request::HttpClient;\r\nuse rusoto_credential::ChainProvider;\r\n\r\nlet mut chain = ChainProvider::new();\r\nchain.set_timeout(Duration::from_millis(200));\r\n\r\nlet client = FooClient::new_with(\r\n  HttpClient::new().expect(\"failed to create request dispatcher\"),\r\n   chain,\r\n   Default::default(),\r\n);\r\n```\r\n\r\nA few things I don't like about this approach is having to introduce two new dependencies in my Cargo.toml file in order to configure the Foo service crate client. A small improvement there may be for service crates to re-export the core/credential types some how\r\n\r\nThere's a Default impl for every configurable piece but the `DispatchSignedRequest` type. I would have liked to fill this in with `new_with(Default::default(), custom_credential_provider_here, Default::default())`\r\n\r\nThe [ChainProvider](https://docs.rs/rusoto_credential/0.12.0/rusoto_credential/struct.ChainProvider.html)'s default is 30 seconds for the wrapping  [ContainerProvider](https://docs.rs/rusoto_credential/0.12.0/rusoto_credential/struct.ContainerProvider.html) and [InstanceMetadataProvider](https://docs.rs/rusoto_credential/0.12.0/rusoto_credential/struct.InstanceMetadataProvider.html). I do not know if 30 was selected from experience with extremely slow local resolution of values but I would assume a better sla on accessing these values from within ec2 instances. I would hope for a sub second sla.\r\n\r\nAssuming there's is no past experience that warranting 30 delay on application initialization do to slow metadata api calls, I'd propose making the default much slower and for applications that expect slow resolution let that be the the exception rather than the default so that other clients ( like cli apps ) can fail fast rather than appear to \"hang\" for 30 seconds before erroring out. \r\n\r\nWhat do others think?\r\n\r\nI have a work around for now and posted above to share with others but if any of these ideas seem sane I'm happy to put in a pr myself to make the default experience more pleasant for others.\r\n\r\n"}}
{"actor":{"display_login":"softprops"}}