How do I troubleshoot issues with AWS Systems Manager Session Manager?
"When I try to use AWS Systems Manager Session Manager, my session fails."
"When I try to use AWS Systems Manager Session Manager, my session fails.ResolutionThe steps to troubleshoot Session Manager issues vary depending on the reason for the session failure.When a session fails because your Amazon Elastic Compute Cloud (Amazon EC2) instance isn't available as a managed instance, troubleshoot your managed instance availability.When a session fails and your EC2 instance is available as a managed instance, troubleshoot Session Manager to resolve these issues:Session Manager doesn't have permission to start a session.Session Manager doesn't have permission to change session preferences.A managed node isn't available or isn't configured for Session Manager.Session Manager plugins aren't added to the command line path (Windows).The system sends a TargetNotConnected error.Session Manager displays a blank screen when you start a session.When a session fails and displays one of the following error messages, apply the appropriate troubleshooting guidance."Your session has been terminated for the following reasons: ----------ERROR------- Encountered error while initiating handshake. Fetching data key failed: Unable to retrieve data key, Error when decrypting data key AccessDeniedException: The ciphertext refers to a AWS KMS key that does not exist, does not exist in this region, or you are not allowed to access. status code: 400, request id: xxxxxxxxxxxx"You receive this error when the users and EC2 instances in your account don't have the required AWS Key Management Service (AWS KMS) key permissions. To resolve this error, turn on AWS KMS encryption for your session data, and then follow these steps:1.    Grant the required KMS key permissions to the users who start sessions and the instances that the sessions connect to. Then, configure AWS Identity and Access Management (IAM) to provide the users and instances with permissions to use the KMS key with Session Manager:To add KMS key permissions for users, see Quickstart default IAM policies for Session Manager.To add KMS key permissions for instances, see Verify or create an IAM role with Session Manager permissions.For Default Host Management Configuration, add a policy to an IAM role that provides KMS key permissions.Note: Starting with AWS Systems Manager Agent (SSM Agent) version 3.2.582.0, Default Host Management Configuration automatically manages EC2 instances without an IAM instance profile. The instances must use Instance Metadata Service Version 2 (IMDSv2)."Your session has been terminated for the following reasons: Couldn't start the session because we are unable to validate encryption on Amazon S3 bucket. Error: AccessDenied: Access Denied status code: 403"You receive this error when you choose Allow only encrypted S3 buckets for S3 logging in your Session Manager preferences. Follow one of these procedures to resolve the error:Open the Systems Manager console, and then choose Session Manager, Preferences, Edit. Under S3 logging, clear Allow only encrypted S3 buckets, and then save your changes. For more information, see Logging session data using Amazon Simple Storage Service (Amazon S3) (console).For instances that you manage using an IAM instance profile, add a policy to the instance profile to provide permissions to upload encrypted logs to Amazon S3. For instructions, see Creating an IAM role with permissions for Session Manager and Amazon S3 and Amazon CloudWatch Logs (console).For instances that you manage using Default Host Management Configuration, add a policy to the IAM role to provide permissions to upload encrypted logs to Amazon S3. For instructions, see Creating an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console)."Your session has been terminated for the following reasons: We couldn't start the session because encryption is not set up on the selected CloudWatch Logs log group. Either encrypt the log group or choose an option to enable logging without encryption."You receive this error when you choose Allow only encrypted CloudWatch log groups for CloudWatch logging in your Session Manager preferences. Follow one of these procedures to resolve the error:Open the Systems Manager console, and then choose Session Manager, Preferences, Edit. Under CloudWatch logging, clear Allow only encrypted CloudWatch log groups, and then save your changes. For more information, see Logging session data using Amazon CloudWatch Logs (console).For instances that you manage using an IAM instance profile, add a policy to the instance profile to provide permissions to upload encrypted logs to Amazon CloudWatch. For instructions, see Creating an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console).For instances that you manage using Default Host Management Configuration, add a policy to the IAM role to provide permissions to upload encrypted logs to CloudWatch. For instructions, see Creating an IAM role with permissions for Session Manager and Amazon S3 and CloudWatch Logs (console).Related informationHow do I attach or replace an instance profile on an Amazon EC2 instance?Logging session activitySetting up Session ManagerFollow"