How can I connect to my Linux Amazon WorkSpaces using SSH?
Last updated: 2022-07-25
I'm unable to connect to my Linux WorkSpace using the Amazon WorkSpaces client.
I want to use the AWS Command Line Interface (AWS CLI) with my Linux WorkSpace.
How do I use SSH to connect to my Linux WorkSpace?
To connect to your Linux WorkSpace using SSH, first identify the WorkSpace IP address and user name, and the NetBIOS name of your directory. Then, connect to your WorkSpace using Linux or PuTTY. Follow these steps:
Note: If you receive errors when running AWS CLI commands,.
Find the WorkSpace IP address and user name
1. Open the Amazon WorkSpaces console, and then choose WorkSpaces from the navigation pane.
2. Choose the arrow next to your WorkSpace to expand the WorkSpace details. Note the WorkSpace IP and the Username. You will use this information later in this procedure.
Note: The WorkSpace IP is the private IP address of the WorkSpace, and is required to associate the elastic network interface with the WorkSpace. You can then retrieve information such as the security group or public IP address associated with the WorkSpace.
Add a rule
1. Open the Amazon Elastic Compute Cloud (Amazon EC2) console, and then choose Network Interfaces from the navigation pane.
2. In the search bar, enter the WorkSpace IP address that you noted earlier.
Important: If you plan to connect to the WorkSpace from outside your virtual private cloud (VPC), note the IPv4 Public IP address.
3. Choose the link from under the Security groups column.
4. Choose the Inbound tab, and then choose Edit.
5. Choose Add Rule, and then enter the following values:
Port Range: 22
Source: If you're connecting from outside the VPC, choose My IP, and then enter the IP address for each remote machine. Otherwise, choose Custom, and then enter the private IP address of another Amazon EC2 instance in the same VPC. Important: Don't enter 0.0.0.0/0 or allow IP addresses that don't need access.
Description: Enter a description for your rule.
6. Choose Save.
Find the NetBIOS name of your directory
1. Open the Directory Service console.
2. Choose the Directory ID link for your directory.
3. Note the Directory NetBIOS name.
Connect to your Linux WorkSpace using Linux
1. Enter the following command, replacing NetBIOS_NAME, Username, and WorkSpaceIP with the values that you noted in earlier steps.
The following is an example of the SSH command where:
- The NetBIOS_NAME is testcompany
- The Username is testuser
- The WorkSpaceIP is 123.456.789.10
2. When prompted, enter the same password that you use when authenticating with the WorkSpaces client.
Note: This is your Active Directory password.
Connect to your Linux WorkSpace using PuTTY
1. In the PuTTY Configuration window, enter the following values:
For Host Name (or IP address), enter the following command, replacing NetBIOS_NAME, Username, and WorkSpaceIP with the values that you noted in earlier steps. The following is a sample command for using PuTTY:
For Port, enter 22
For Connection type, choose SSH
2. Choose Open.
3. When prompted, enter the same password that you use when authenticating with the WorkSpaces client. This is your Active Directory password.
Note: It's a best practice to use this method only to connect to a WorkSpace for troubleshooting purposes. After you complete your troubleshooting steps, remove the inbound rule that you added.