AWS CloudShell で「Error: Failed to open session.」が発生するときの対処方法
困っていた内容
プロキシ経由で AWS CloudShell にアクセスすると「Error: Failed to open session.」で使用できません。
AWS CloudShell はプロキシ経由では使用できないのでしょうか。使用する方法を教えてください。
Preparing your terminal...
Failed to open session : Timed out while opening the session
Trying to open session (Retrying. Attempt #1)
Failed to open session : Timed out while opening the session
Trying to open session (Retrying. Attempt #2)
Failed to open session : Timed out while opening the session
Trying to open session (Retrying. Attempt #3)
Failed to open session : Timed out while opening the session
Trying to open session (Retrying. Attempt #4)
Failed to open session : Timed out while opening the session
Failed to open session : Timed out while opening the session
There were some issues preparing your terminal.
Error: Failed to open session.
Refresh the browser to reconnect and continue using your CloudShell session.
Preparing your terminal...
どう対応すればいいの?
WebSocket の対応可否と、エンドポイントへのアクセスがブロックされていないかを確認してください。
wss://ssmmessages.<region>.amazonaws.com
# 東京リージョンの場合
wss://ssmmessages.ap-northeast-1.amazonaws.com
AWS CloudShell のネットワーク要件として WebSocket プロトコルが利用できる必要があります。
プロキシや VPN などが WebSocket プロトコルに対応していない場合やアクセス制限されている場合、Failed to open sessionエラーが発生し、AWS CloudShell が利用できないことがあります。
そのため、ご利用のプロキシサーバーの仕様や設定状況を確認し、必要に応じて設定変更をご検討ください。
参考資料
CloudShell ネットワーク要件
WebSockets
CloudShell は WebSocket プロトコルに依存しています。…(中略)…
プロキシサーバーが WebSockets の正常な動作を妨げることがあります。この問題が発生した場合、CloudShell インターフェースは次のエラーを報告します (Failed to open sessions : Timed out while opening the session)。
このエラーが繰り返し発生する場合は、プロキシサーバーのドキュメントを参照して、WebSockets を許可するように設定されていることを確認します。または、ネットワークのシステム管理者に問い合わせてください。
Unsupported Web Sockets cause a failure to start CloudShell sessions
Issue: When you try to start AWS CloudShell, you repeatedly receive the following message: Failed to open sessions : Timed out while opening the session.Cause: CloudShell depends on the WebSocket protocol, which allows for two-way interactive communication between your web browser and AWS CloudShell. If you're using a browser in a private network, secure access to the internet is probably facilitated by proxy servers and firewalls. WebSocket communication can usually traverse proxy servers without a problem. But, in some cases, proxy servers prevent WebSockets from working correctly. If this issue occurs, CloudShell can't start a shell session and the attempt to connect eventually times out.
Solution: A connection timeout might be caused by an issue other than unsupported WebSockets. If this is the case, first refresh the browser window where the CloudShell command line interface is located.
If you're still getting timeout errors after the refresh, see the documentation for your proxy server. And, make sure that your proxy server is configured to allow Web Sockets. Alternatively, contact your network's system administrator.









