aws / amazon-ssm-agent

An agent to enable remote management of your EC2 instances, on-premises servers, or virtual machines (VMs).
https://aws.amazon.com/systems-manager/
Apache License 2.0
1.06k stars 326 forks source link

Agent keeps retrying instance profile credentials instead of SSM role #543

Closed JackelynOliveira closed 11 months ago

JackelynOliveira commented 1 year ago

SSM Agent: 3.2.1705.0 Resource type: EC2 instance OS: Ubuntu 18.04.1 LTS (64 bit)

Logs:

2023-10-25 22:14:42 INFO [ssm-agent-worker] Entering SSM Agent hibernate - AccessDeniedException: User: arn:aws:sts::ACCOUNT:assumed-role/CUSTOM_EC2_ROLE/INSTANCE_ID is not authorized to perform: ssm:UpdateInstanceInformation on resource: arn:aws:ec2:REGION:ACCOUNT:instance/INSTANCE_ID because no identity-based policy allows the ssm:UpdateInstanceInformation action
    status code: 400, request id: [...]
2023-10-25 22:16:24 WARN EC2RoleProvider Failed to connect to Systems Manager with instance profile role credentials. Err: retrieved credentials failed to report to ssm. RequestId: [...] Error: AccessDeniedException: User: arn:aws:sts::ACCOUNT:assumed-role/CUSTOM_EC2_ROLE/INSTANCE_ID is not authorized to perform: ssm:UpdateInstanceInformation on resource: arn:aws:ec2:REGION:ACCOUNT:instance/INSTANCE_ID because no identity-based policy allows the ssm:UpdateInstanceInformation action
    status code: 400, request id: [...]
2023-10-25 22:16:24 INFO EC2RoleProvider Successfully connected with Systems Manager role credentials
2023-10-25 22:16:24 INFO [CredentialRefresher] Credentials ready
2023-10-25 22:16:24 INFO [CredentialRefresher] Next credential rotation will be in 29.993814139633333 minutes
2023-10-25 22:46:24 WARN EC2RoleProvider Failed to connect to Systems Manager with instance profile role credentials. Err: retrieved credentials failed to report to ssm. RequestId: [...] Error: AccessDeniedException: User: arn:aws:sts::ACCOUNT:assumed-role/CUSTOM_EC2_ROLE/INSTANCE_ID is not authorized to perform: ssm:UpdateInstanceInformation on resource: arn:aws:ec2:REGION:ACCOUNT:instance/INSTANCE_ID because no identity-based policy allows the ssm:UpdateInstanceInformation action
    status code: 400, request id: [...]
2023-10-25 22:46:24 INFO EC2RoleProvider Successfully connected with Systems Manager role credentials
2023-10-25 22:46:24 INFO [CredentialRefresher] Credentials ready
2023-10-25 22:46:24 INFO [CredentialRefresher] Next credential rotation will be in 29.995949605633335 minutes
2023-10-25 23:16:24 WARN EC2RoleProvider Failed to connect to Systems Manager with instance profile role credentials. Err: retrieved credentials failed to report to ssm. RequestId: [...] Error: AccessDeniedException: User: arn:aws:sts::ACCOUNT:assumed-role/CUSTOM_EC2_ROLE/INSTANCE_ID is not authorized to perform: ssm:UpdateInstanceInformation on resource: arn:aws:ec2:REGION:ACCOUNT:instance/INSTANCE_ID because no identity-based policy allows the ssm:UpdateInstanceInformation action
    status code: 400, request id: [...]
2023-10-25 23:16:24 INFO EC2RoleProvider Successfully connected with Systems Manager role credentials
2023-10-25 23:16:24 INFO [CredentialRefresher] Credentials ready
2023-10-25 23:16:24 INFO [CredentialRefresher] Next credential rotation will be in 29.997133145116667 minutes
cjinaws commented 1 year ago

The log below shows that the default host management role is being used and that the instance is connected to Systems Manager.

2023-10-25 22:16:24 INFO EC2RoleProvider Successfully connected with Systems Manager role credentials

sluggard76 commented 11 months ago

Based on the observation by cjinaws, there are no issues to obtain the credential. Closing the issue. Feel free to reopen or create a new issue if the problem persists.