{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/19561","repository_url":"https://api.github.com/repos/elastic/elasticsearch","labels_url":"https://api.github.com/repos/elastic/elasticsearch/issues/19561/labels{/name}","comments_url":"https://api.github.com/repos/elastic/elasticsearch/issues/19561/comments","events_url":"https://api.github.com/repos/elastic/elasticsearch/issues/19561/events","html_url":"https://github.com/elastic/elasticsearch/pull/19561","id":167151398,"number":19561,"title":"Use `DefaultAWSCredentialsProviderChain` AWS SDK class for credentials","user":{"login":"dadoonet","id":274222,"avatar_url":"https://avatars.githubusercontent.com/u/274222?v=3","gravatar_id":"","url":"https://api.github.com/users/dadoonet","html_url":"https://github.com/dadoonet","followers_url":"https://api.github.com/users/dadoonet/followers","following_url":"https://api.github.com/users/dadoonet/following{/other_user}","gists_url":"https://api.github.com/users/dadoonet/gists{/gist_id}","starred_url":"https://api.github.com/users/dadoonet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dadoonet/subscriptions","organizations_url":"https://api.github.com/users/dadoonet/orgs","repos_url":"https://api.github.com/users/dadoonet/repos","events_url":"https://api.github.com/users/dadoonet/events{/privacy}","received_events_url":"https://api.github.com/users/dadoonet/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/:Plugin%20Discovery%20EC2","name":":Plugin Discovery EC2","color":"009800"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/enhancement","name":"enhancement","color":"4a4ea8"},{"url":"https://api.github.com/repos/elastic/elasticsearch/labels/v5.0.0","name":"v5.0.0","color":"dddddd"}],"state":"closed","locked":false,"assignee":{"login":"dadoonet","id":274222,"avatar_url":"https://avatars.githubusercontent.com/u/274222?v=3","gravatar_id":"","url":"https://api.github.com/users/dadoonet","html_url":"https://github.com/dadoonet","followers_url":"https://api.github.com/users/dadoonet/followers","following_url":"https://api.github.com/users/dadoonet/following{/other_user}","gists_url":"https://api.github.com/users/dadoonet/gists{/gist_id}","starred_url":"https://api.github.com/users/dadoonet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dadoonet/subscriptions","organizations_url":"https://api.github.com/users/dadoonet/orgs","repos_url":"https://api.github.com/users/dadoonet/repos","events_url":"https://api.github.com/users/dadoonet/events{/privacy}","received_events_url":"https://api.github.com/users/dadoonet/received_events","type":"User","site_admin":false},"assignees":[{"login":"dadoonet","id":274222,"avatar_url":"https://avatars.githubusercontent.com/u/274222?v=3","gravatar_id":"","url":"https://api.github.com/users/dadoonet","html_url":"https://github.com/dadoonet","followers_url":"https://api.github.com/users/dadoonet/followers","following_url":"https://api.github.com/users/dadoonet/following{/other_user}","gists_url":"https://api.github.com/users/dadoonet/gists{/gist_id}","starred_url":"https://api.github.com/users/dadoonet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dadoonet/subscriptions","organizations_url":"https://api.github.com/users/dadoonet/orgs","repos_url":"https://api.github.com/users/dadoonet/repos","events_url":"https://api.github.com/users/dadoonet/events{/privacy}","received_events_url":"https://api.github.com/users/dadoonet/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2016-07-22T23:30:01Z","updated_at":"2016-07-28T15:56:23Z","closed_at":"2016-07-28T15:55:53Z","pull_request":{"url":"https://api.github.com/repos/elastic/elasticsearch/pulls/19561","html_url":"https://github.com/elastic/elasticsearch/pull/19561","diff_url":"https://github.com/elastic/elasticsearch/pull/19561.diff","patch_url":"https://github.com/elastic/elasticsearch/pull/19561.patch"},"body":"Follow up discussion at https://github.com/elastic/elasticsearch/pull/18690#issuecomment-234505083\r\n\r\nReading the best practices [recommended by AWS](http://docs.aws.amazon.com/java-sdk/latest/developer-guide/credentials.html), we should use `DefaultAWSCredentialsProviderChain` instead of providing the detail of the chain ourselves.\r\n\r\nFor now, we read credentials (if not provided in `elasticsearch.yml`) using:\r\n\r\n```java\r\ncredentials = new AWSCredentialsProviderChain(\r\n   new SystemPropertiesCredentialsProvider(),\r\n   new EnvironmentVariableCredentialsProvider(),\r\n   new InstanceProfileCredentialsProvider()\r\n);\r\n```\r\n\r\nWhich means that we read from:\r\n\r\n* Environment Variables - `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` (RECOMMENDED since they are recognized by all the AWS SDKs and CLI except for .NET), or `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` (only recognized by Java SDK)\r\n* Java System Properties - `aws.accessKeyId` and `aws.secretKey`\r\n* Instance profile credentials delivered through the Amazon EC2 metadata service\r\n\r\nUsing instead:\r\n\r\n```java\r\ncredentials = new DefaultAWSCredentialsProviderChain();\r\n```\r\n\r\nWill give us two new more methods out of the box:\r\n\r\n> * Credential profiles file at the default location (`~/.aws/credentials`) shared by all AWS SDKs and the AWS CLI\r\n> * Credentials delivered through the Amazon EC2 container service if `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` environment variable is set and security manager has permission to access the variable\r\n\r\nCherry on the cake: as soon as AWS SDK will propose a new implementation, we will benefit from it without any modification (just updating the SDK).\r\n\r\nWe also simplify\r\n\r\n```\r\nnew AWSCredentialsProviderChain(new StaticCredentialsProvider(new BasicAWSCredentials(key, secret)));\r\n```\r\n\r\nAs there is no need to wrap StaticCredentialsProvider in AWSCredentialsProviderChain.\r\n\r\nCloses #19556."},"comment":{"url":"https://api.github.com/repos/elastic/elasticsearch/issues/comments/235939595","html_url":"https://github.com/elastic/elasticsearch/pull/19561#issuecomment-235939595","issue_url":"https://api.github.com/repos/elastic/elasticsearch/issues/19561","id":235939595,"user":{"login":"dadoonet","id":274222,"avatar_url":"https://avatars.githubusercontent.com/u/274222?v=3","gravatar_id":"","url":"https://api.github.com/users/dadoonet","html_url":"https://github.com/dadoonet","followers_url":"https://api.github.com/users/dadoonet/followers","following_url":"https://api.github.com/users/dadoonet/following{/other_user}","gists_url":"https://api.github.com/users/dadoonet/gists{/gist_id}","starred_url":"https://api.github.com/users/dadoonet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dadoonet/subscriptions","organizations_url":"https://api.github.com/users/dadoonet/orgs","repos_url":"https://api.github.com/users/dadoonet/repos","events_url":"https://api.github.com/users/dadoonet/events{/privacy}","received_events_url":"https://api.github.com/users/dadoonet/received_events","type":"User","site_admin":false},"created_at":"2016-07-28T15:56:23Z","updated_at":"2016-07-28T15:56:23Z","body":"Thank you @ywelsch!"}}
{"actor":{"display_login":"dadoonet"}}