The security token included in the request is invalid

0

I am patching my RHEL server using Patch manager but I am getting below error

ClientError: An error occurred (UnrecognizedClientException) when calling the GetDeployablePatchSnapshotForInstance operation: The security token included in the request is invalid root [INFO]: Unable to retrieve snapshot with default ssm client, retry with fallback ssm client botocore.credentials [INFO]: Found credentials in shared credentials file: ~/.aws/credentials

How to clear the credentials in ~/.aws/credentials in session manager ? Enter image description here

질문됨 4달 전483회 조회
1개 답변
0
수락된 답변

Hello.

I think it is probably reading the credentials of the user (root) running SSM Agent, so I think you need to look for the "/root/.aws/credentials" setting.
https://docs.aws.amazon.com/systems-manager/latest/userguide/ssm-agent-technical-details.html

On Linux and macOS, SSM Agent runs as the root user. Therefore, the environment variables and credentials file that SSM Agent looks for in this process are those of the root user only (/root/.aws/credentials). SSM Agent doesn't look at the environment variables or credentials file of any other users on the instance during the search for credentials.

By the way, are you trying to apply the patch to RHEL running on EC2?
In that case, I think you can use it without setting an access key by setting the IAM policy "AmazonSSMManagedInstanceCore" in the EC2 IAM role.
https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-instance-permissions.html

profile picture
전문가
답변함 4달 전
profile pictureAWS
전문가
검토됨 4달 전
  • Thank you in a million. I found it in "/root/.aws/credentials and deleted it. I was able to patch the ec2 instance successfully.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠