AWS SSM can't ping to my ec2 instance

0

i have 2 ec2 instance, and one of them can't remote using ssm fleet manager. i tried to reinstall the agent but it's still doesn't work. Default Host Management Configuration is already configured with the AWSSystems ManagerDefaultEC2instanceManagementRole (recommended).

here's the logs that i've gathered from the ssm

2023-11-26 20:15:58 INFO [ssm-agent-worker] [MessageService] [MDSInteractor] increasing error count by 1
2023-11-26 20:16:01 ERROR EC2RoleProvider unable to load shared credentials. Err: shared credentials are already expired, they were retrieved at 2023-11-24T19:34:38Z and expired at 2023-11-24T20:29:38Z
2023-11-26 20:16:01 ERROR [ssm-agent-worker] [MessageService] [MDSInteractor] error when calling AWS APIs. error details - GetMessages Error: unable to load shared credentials. Err: shared credentials are already expired, they were retrieved at 2023-11-24T19:34:38Z and expired at 2023-11-24T20:29:38Z
2023-11-26 20:16:01 INFO [ssm-agent-worker] [MessageService] [MDSInteractor] increasing error count by 1
2023-11-26 20:16:03 ERROR EC2RoleProvider unable to load shared credentials. Err: shared credentials are already expired, they were retrieved at 2023-11-24T19:34:38Z and expired at 2023-11-24T20:29:38Z

any idea to fix this issue?

seargex
asked 4 months ago244 views
2 Answers
4

Hi seargex,

The problem you are currently experiencing seems to be caused by the expiration of the IAM Role attached to EC2.

This problem will be resolved if you modify IAM Role which is attached to the instance.

  • Modify IAM Role: EC2 > Choose EC2 Instance to modify > [Actions] > [Security] > "Modify IAM role"

You can refer to the document below for the required permissions:

[+] Create an IAM Policy with Fleet Manager permissions (AWS Documentation)

Please refer to the case in Stack Overflow which includes an answer from AWS Support Team for S3 about a similar situation: [+] stack-overflow aws credentials refreshed but still expired


FYI. You can also check the expiration of the credentials with the command below:

TOKEN=`curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600"` && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/iam/security-credentials/<YOUR+EC2+IAM+ROLE>]

[+] Retrieve security credentials from instance metadata


If I have missed anything or answered wrong, please feel free to ask me again. Also you have any questions, comment please!

profile picture
answered 4 months ago
0
Accepted Answer

turns out there's a problem with the local time on the OS instances, i have to use Amazon Time Sync Service to sync up the time with it and it solves the problem.

seargex
answered 4 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions