Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upService Discovery on AWS API denied using EC2 role #4686
Comments
simonpasquier
added
the
component/service discovery
label
Oct 2, 2018
This comment has been minimized.
This comment has been minimized.
lostick
commented
Oct 8, 2018
|
You might need to add |
simonpasquier
added
the
kind/more-info-needed
label
Oct 9, 2018
This comment has been minimized.
This comment has been minimized.
I already gave it access as per the following:
which includes ec2:DescribeTags |
This comment has been minimized.
This comment has been minimized.
anshulshrivastava
commented
Nov 15, 2018
•
|
Same issue for me. prometheus.yml file
logs from Prometheus container -
I am not sure what I am missing here. |
This comment has been minimized.
This comment has been minimized.
DasFranck
commented
Dec 3, 2018
|
I've the same problem, with the same config. |
This comment has been minimized.
This comment has been minimized.
nizam001
commented
Jan 14, 2019
|
I also faced same issue , but after some hit and trial I found that , "role_arn" is the culprit, instead of this use "profile". It worked for me. ec2_sd_configs: |
This comment has been minimized.
This comment has been minimized.
ldormoy
commented
Jan 29, 2019
|
I face the exact same issue with prometheus in a multi-account AWS structure. Using "profile" instead of "role_arn" results in prometheus discovering the EC2 instances of the AWS account where it runs. I actually want it to perform cross-account discovery. I also do not want to create extra AWS access keys for prometheus in each account: assumable IAM roles exist for this purpose. |
This comment has been minimized.
This comment has been minimized.
|
I used profile instead and it worked, HOWEVER I still believe that the right fix is to have the role name be able to call the API directly instead of having to specify the role_arn or in this case the profile_arn. For example instead of role_arn: arn:aws:iam::XXXXXXXXXX:role/prometheus_ec2_readonly we should be able to call the machine role directly and discover the arn from within the instance role: prometheus_ec2_readonly |
This comment has been minimized.
This comment has been minimized.
|
If anyone has a clue of how this can be achieved with the AWS Go SDK, feel free to open a PR. Other than that I'm afraid that none of the Prometheus maintainers is familiar enough with the EC2 SD mechanism to tackle this. |
This comment has been minimized.
This comment has been minimized.
nizam001
commented
Feb 22, 2019
•
|
Guys, we have been actually confused by the "role_arn" option. Think, if that IAM role is attached to my instance itself then why should I explicitly pass role_arn? I was investigating prometheus code for ec2 service discovery, I saw role_arn parameter is being used badly, there is no need to pass this parameter at all. AWS 'go' sdk takes care of this thing , if role is attached to instance, it creates temporary creds by sts assume role. Also, there is no need to pass profile parameter as well, there should only be options of API keys and region. As long as someone is passing API keys OR instance is having an IAM role attached, its enough. If IAM role is attached to instance, following code is working, Don't pass profile or role_arn param
|
This comment has been minimized.
This comment has been minimized.
grockeek
commented
Mar 22, 2019
|
@ldormoy : I was able to achieve this, creating a unique pair of access/secret key :
Through that, you can configure
And use this block n-times (n-role) to scrape exporter in different account and/or region ;) |
This comment has been minimized.
This comment has been minimized.
|
@grockeek The functionality is to NOT use keys or store keys locally as it's insecure and can be easily exploited, rather the EC2 machine role AKA role_arn in this case. The api SHOULD be able to handle what role to use without the role_arn but it does not. |
DrHashi commentedOct 1, 2018
Proposal
Fix AWS api calls to describe instance while using ec2_profile/role
Bug Report
What did you expect to see?
nodes being automatically propagated