[Solved] AWS SSM - An error occurred (AccessDeniedException) when calling the TerminateSession operation
An error occurred (AccessDeniedException) - TerminateSession operation
An error occurred (AccessDeniedException) when calling the TerminateSession operation typically occurs when the user making the request does not have the necessary permissions to perform the specified operation.
Here are some steps you can take to troubleshoot and resolve this issue:
- Check IAM Permissions:
Ensure that the user or role making the TerminateSession request has the necessary permissions. You can do this by checking the IAM (Identity and Access Management) policies attached to the user or role. The user should have the required permissions for the TerminateSession action.
- IAM Policy Example:
An example IAM policy allowing the TerminateSession action might look like this:{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "ssm:TerminateSession", "Resource": "*" } ] }
Ensure that the policy is attached to the user or role making the request.
-
Check Resource ARN:
Verify that the ARN (Amazon Resource Name) specified in the request is correct. The resource ARN is the Amazon Resource Name of the session that you are trying to terminate. It should match the resource specified in the IAM policy. -
AWS CLI Troubleshooting:
If you are using the AWS CLI, ensure that the credentials being used have the necessary permissions. You can check the credentials configured on your machine using the aws configure command. -
CloudTrail Logs:
Check AWS CloudTrail logs for more details on the error. CloudTrail logs provide information on API calls made on your AWS account, including details about denied requests. -
Check if session-manager plugin is installed:
Follow the steps outlined in this documentation.
Hope that helps!!!!