Bobcares

Access EC2 Mac instance via GUI – How to do it

by | Aug 27, 2021

Wondering how to access EC2 Mac instance via GUI? We can help you.

As a part of our AWS Support Services, we often receive similar requests from our AWS customers.

Today, let’s see the steps followed by our Support Techs to help our customers.

How to access EC2 Mac instance via GUI?

Today, let us see the steps followed by our Support techs to perform this task.

1.Firstly, connect to your EC2 Mac instance using SSH.

Linux

Use the following command to SSH to your EC2 Mac instance as ec2-user.

Replace keypair_file with your key pair and Instance-Public-IP with the public IP of your instance.

% ssh -i keypair_file ec2-user@Instance-Public-IP

Windows

Windows 10 and newer versions of Windows Server have an OpenSSH client installed by default.

Or, you can enable the OpenSSH client by selecting Settings, Apps, Apps & features, Manage optional features, Add a feature, and then select OpenSSH Client.

If you’re using an older version of Windows, then use Git Bash to execute the preceding command.

Please note the instance can be in a public subnet and accessible through a public IP address or an Elastic IP address. You can use a bastion/jumphost to connect to the instance.

Or, you can establish a connection using AWS VPN or AWS Direct Connect that allows you to access your instance through a private IP.

For security reasons, traffic to the VNC server is tunneled using SSH. It’s a best practice to avoid opening VNC ports in your security groups.

2.Then, run the following command to install and start VNC (macOS screen sharing SSH) from the Mac instance

sudo defaults write /var/db/launchd.db/com.apple.launchd/overrides.plist com.apple.screensharing -dict Disabled -bool false
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist

3.Next, run the following command to set a password for ec2-user:

sudo /usr/bin/dscl . -passwd /Users/ec2-user

4.Then, create an SSH tunnel to the VNC port.

In the following command, replace keypair_file with your SSH key path and 192.0.2.0 with your instance’s IP address or DNS name.

ssh -i keypair_file -L 5900:localhost:5900 ec2-user@192.0.2.0

Note: The SSH session should be running while you’re in the remote session.

5.Using a VNC client, connect to localhost:5900.

6.Finally, the GUI of the macOS launches.

Connect to the remote session of the Mac instance as ec2-user using the password that you set in step 3.

 

[Need help with more AWS queries? We’d be happy to assist]

Conclusion

To conclude, today we discussed the steps followed by our Support Engineers  to access EC2 Mac instance via GUI.

 

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.