如何對 AWS Systems Manager Session Manager 的問題進行疑難排解?
當我嘗試使用 AWS Systems Manager Session Manager 時,我的工作階段失敗。
解決方法
如果 Amazon Elastic Compute Cloud (Amazon EC2) 執行個體無法作為受管理執行個體而導致工作階段失敗時,請對受管理執行個體可用性進行疑難排解。
如果工作階段失敗且您的 Amazon EC2 執行個體作為受管理執行個體可用,請對 Session Manager 進行疑難排解以解決下列問題:
- Session Manager 沒有啟動工作階段的權限。
- Session Manager 沒有變更工作階段偏好設定的權限。
- 受管理節點不可用於或未設定用於 Session Manager。
- Session Manager 外掛程式未新增至命令行路徑 (Windows)。
- 系統會傳送 TargetNotConnected 錯誤。
- Session Manager 在您啟動工作階段時顯示空白畫面。
如果工作階段失敗並顯示下列其中一個錯誤訊息,請套用適當的疑難排解指南。
"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: nnnnnnnnnnnn"
當您帳戶中的使用者和 EC2 執行個體沒有必要的 AWS Key Management Service (KMS) 金鑰權限時,您會收到此錯誤。若要解決此錯誤,請為您的工作階段資料開啟 AWS KMS 加密,然後完成下列步驟:
- 將所需的 AWS KMS key 權限授予啟動工作階段的使用者以及工作階段連線的執行個體。
- 設定 AWS Identity and Access Management (IAM),為使用者和執行個體提供對 Session Manager 使用 AWS KMS key 的權限:
若要為使用者新增 AWS KMS key 權限,請參閱 Session Manager 的範例 IAM 政策。
若要為執行個體新增 AWS KMS key 權限,請參閱驗證或新增 Session Manager 的執行個體權限。
對於「預設主機管理組態」,將政策新增至提供 AWS KMS key 權限的 IAM 角色。
**注意:**在 AWS Systems Manager Agent (SSM Agent) 3.2.582.0 版和更新版本中,預設主機管理組態會自動管理不含 IAM 執行個體設定檔的 EC2 執行個體。執行個體必須使用 Instance Metadata Service 版本 2 (IMDSv2)。
"Error - Fleet Manager is unable to start the session because the WebSocket connection closed unexpectedly during the handshake.Verify that your instance profile has sufficient Sessions Manager and AWS KMS permissions.For a more detailed message, visit the Session Manager console"
附加目標執行個體的執行個體設定檔角色缺少下列權限時,您可能會遇到此錯誤。若要搭配 AWS KMS 使用 AWS Systems Manager,需要 kms:Decrypt 權限,才能允許工作階段資料的客戶金鑰加密和解密。
{ "Effect": "Allow", "Action": [ "kms:Decrypt" ], "Resource": "key-name" }
若要解決此錯誤,請更新附加至執行個體之執行個體設定檔角色的權限。如需 Session Manager 權限範例,請參閱將 Session Manager 權限新增至現有 IAM 角色。
"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"
在 Session Manager 偏好設定中為 S3 記錄選擇僅允許加密的 S3 儲存貯體時,您會收到此錯誤。若要解決該錯誤,請完成下列步驟:
- 開啟 AWS Systems Manager 主控台。
- 選擇 Session Manager、偏好設定,然後選擇編輯。
- 在 S3 logging (S3 記錄) 下,清除Allow only encrypted S3 buckets (僅允許加密的 S3 儲存貯體),然後儲存您的變更。
如需詳細資訊,請參閱使用 Amazon S3 (主控台) 記錄工作階段資料。 - 對於使用 IAM 執行個體設定檔管理的執行個體,請將政策新增至執行個體設定檔,以提供將加密日誌上傳至 Amazon S3 的權限。如需說明,請參閱建立具有 Session Manager 以及 Amazon S3 和 Amazon CloudWatch Logs (主控台) 權限的 IAM 角色。
- 對於使用預設主機管理組態管理的執行個體,請將政策新增至 IAM 角色,以提供將加密日誌上傳至 Amazon S3 的權限。如需詳細資訊,請參閱建立具有 Session Manager 以及 Amazon S3 和 CloudWatch Logs (主控台) 權限的 IAM 角色。
"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"
在 Session Manager 偏好設定中為 CloudWatch 記錄選擇僅允許加密的 CloudWatch 日誌群組時,您會收到此錯誤。若要解決該錯誤,請完成下列步驟:
- 開啟 AWS Systems Manager 主控台。
- 選擇 Session Manager、偏好設定,然後選擇編輯。
- 在 CloudWatch logging (CloudWatch 記錄) 下,清除 Allow only encrypted CloudWatch log groups (僅允許加密的 CloudWatch 日誌群組),然後儲存您的變更。
如需詳細資訊,請參閱使用 Amazon CloudWatch Logs (主控台) 記錄工作階段資料。 - 對於使用 IAM 執行個體設定檔管理的執行個體,請將政策新增至執行個體設定檔,以提供將加密日誌上傳至 Amazon CloudWatch 的權限。如需說明,請參閱建立具有 Session Manager 以及 Amazon S3 和 CloudWatch Logs (主控台) 權限的 IAM 角色。
- 對於使用預設主機管理組態管理的執行個體,請將政策新增至 IAM 角色,以提供將加密日誌上傳至 CloudWatch 的權限。如需說明,請參閱建立具有 Session Manager 以及 Amazon S3 和 CloudWatch Logs (主控台) 權限的 IAM 角色。
"Your session has been terminated for the following reasons: ----------ERROR------- Unable to start command: Failed to create user ssm-user: Instance is running active directory domain controller service.Disable the service to continue to use session manager"
使用適用於 AWS Systems Manager for Windows Server 時,您可能會遇到此錯誤。此錯誤的原因取決於執行個體上執行的 SSM 代理程式版本。
- 在 SSM 代理程式版本 2.3.612.0 和更新版本中,ssm-user 帳戶不會在做為網域控制器的 Windows Server 電腦上建立。必須手動建立具有 ssm-user 名稱的使用者帳戶,並設定必要的權限。
- 若要識別 SSM 代理程式版本,請參閱檢查 SSM 代理程式版本號碼。另請在 GitHub 網站上檢閱 SSM 代理程式版本資訊。
- 若要訂閱 SSM 代理程式通知,請參閱訂閱 SSM 代理程式通知。
- 若要將 SSM 代理程式設定為自動更新,請參閱將 SSM 代理程式的更新自動化。
相關資訊
- 語言
- 中文 (繁體)

相關內容
已提問 3 年前
已提問 2 年前
