Cherry-pick #17658 to 7.x: Add support for IAM role arn in aws config #17726
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Cherry-pick of PR #17658 to 7.x branch. Original message:
What does this PR do?
This PR is to add support for IAM role arn in AWS credentials config.
Why is it important?
When user doesn't want to store any credentials for Metricbeat/Filebeat locally(for example in EC2 instance), it's better to leverage AWS IAM role. A role does not have standard long-term credentials such as a password or access keys associated with it. Instead, when you assume a role, it provides you with temporary security credentials for your role session. IAM role Amazon Resource Name (ARN) can be used to specify which AWS IAM role to assume to generate temporary credentials.
Using
role_arn
also solves reload temporary credential problem in #17189.sts.NewAssumeRoleProvider
withrole_arn
input constructs and returns a credentials provider that will retrieve credentials by assuming a IAM role using STS.AssumeRoleProvider
has a a functionretrieveFn
, which generates a new set of temporary credentials using STS.Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.How to test this PR locally
arn:aws:iam::428152502467:role/test-mb
modules.d/aws.yml
to userole_arn
:./metricbeat -e
and with the correct permissions in IAM role, ec2 metrics should be collected and sent to Elasticsearch.Related issues