Why AWS.EC2MetadataCredentials giving wrong role?

旧城冷巷雨未停 提交于 2019-12-11 17:15:08

问题


We have node service(V8.15.1) deployed on AWS EC2 containers using ECS.We have AWS_ACCESS_KEY setup in environment as well as a role is mapped to EC2 instances. I am supposed to use EC2 instance role to access AWS SSM. So, i tried below:

AWS.config.credentials = new AWS.EC2MetadataCredentials();

and tried to read parameter from SSM. i get below error:

{
    "msg": "User: arn:aws:sts::AccountID:assumed-role/role-name/i-*****92a is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:resource_id:parameter/parame_id"
}

Please note, i-*****92a(instance id in role name) which i think doesn't let me access SSM parameter because actual role name is without instanceid in it.

Expected: It should have resulted into actual role name without instanceid appended.


回答1:


We figured, it is a normal behaviour. The issue was that one of the parameter nme set was wrong in SSM and hence this role was not able read that.



来源:https://stackoverflow.com/questions/57686244/why-aws-ec2metadatacredentials-giving-wrong-role

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!