115 lines
4.0 KiB
Markdown
115 lines
4.0 KiB
Markdown
|
|
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-mac-instances.html
|
|
|
|
macOS Mojave (version 10.14) (x86 Mac instances only)
|
|
|
|
macOS Catalina (version 10.15) (x86 Mac instances only)
|
|
|
|
macOS Big Sur (version 11) (x86 and M1 Mac instances)
|
|
|
|
macOS Monterey (version 12) (x86 and M1 Mac instances)
|
|
|
|
macOS Ventura (version 13) (all Mac instances, M2 and M2 Pro Mac instances support macOS Ventura version 13.2 or later)
|
|
|
|
macOS Sonoma (version 14) (all Mac instances)
|
|
|
|
macOS Sequoia (version 15) (all Mac instances)
|
|
|
|
|
|
|
|
https://aws.amazon.com/blogs/compute/building-amazon-machine-images-amis-for-ec2-mac-instances-with-packer/
|
|
|
|
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/macos-ami-overview.html
|
|
|
|
|
|
## Install Apple Remote Desktop
|
|
# NB: These commands are when using SSH to connect, when connected with SSM, switch to ec2-user first with 'su -c ec2-user'
|
|
|
|
# set a password to ec2-user
|
|
sudo passwd ec2-user
|
|
|
|
# enable ARD
|
|
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
|
|
-activate -configure -access -on \
|
|
-restart -agent -privs -all
|
|
|
|
## SSM Tunnels to connect to Apple Remote Desktop
|
|
|
|
```shell
|
|
# first, select the instance ID of the machine you want to connect
|
|
# the below command search for a machine named "macOS Monterey"
|
|
INSTANCE_ID=$(aws ec2 describe-instances \
|
|
--filter "Name=tag:Name,Values=macOS Monterey" \
|
|
--query "Reservations[].Instances[?State.Name == 'running'].InstanceId[]" \
|
|
--output text)
|
|
|
|
# second, start the SSM tunnel
|
|
aws ssm start-session --target $INSTANCE_ID \
|
|
--document-name AWS-StartPortForwardingSession \
|
|
--parameters '{"portNumber":["5900"],"localPortNumber":["5900"]}'
|
|
|
|
Starting session with SessionId: sst-0f3b970f24182795d
|
|
Port 5900 opened for sessionId sst-0f3b970f24182795d.
|
|
Waiting for connections...
|
|
```
|
|
|
|
## Connect w/ssh and tunnel VNC ports
|
|
# We assume the EC2 Mac instance public IP address is 1.0.0.0
|
|
ssh -C -N -L 5900:localhost:5900 -i /path/my-key-pair.pem ec2-user@1.0.0.0
|
|
|
|
|
|
|
|
## Changing resolution
|
|
|
|
```shell
|
|
# install the displaylist command line tool
|
|
brew tap jakehilborn/jakehilborn && brew install displayplacer
|
|
|
|
# then list available resolutions
|
|
displayplacer list
|
|
|
|
Persistent screen id: 69784AF1-CD7D-B79B-E5D4-60D937407F68
|
|
Contextual screen id: 1020887298
|
|
Type: 24 inch external screen
|
|
Resolution: 1024x768
|
|
Hertz: 60
|
|
Color Depth: 8
|
|
Scaling:off
|
|
Origin: (0,0) - main display
|
|
Rotation: 0
|
|
Resolutions for rotation 0:
|
|
mode 0: res:1024x768 hz:60 color_depth:4
|
|
mode 1: res:1024x768 hz:60 color_depth:8 <-- current mode
|
|
mode 2: res:640x480 hz:60 color_depth:4
|
|
mode 3: res:640x480 hz:60 color_depth:8
|
|
mode 4: res:720x480 hz:60 color_depth:4
|
|
mode 5: res:720x480 hz:60 color_depth:8
|
|
mode 6: res:640x480 hz:60 color_depth:4
|
|
mode 7: res:640x480 hz:60 color_depth:8
|
|
mode 8: res:800x600 hz:60 color_depth:4
|
|
mode 9: res:800x600 hz:60 color_depth:8
|
|
mode 10: res:1280x720 hz:60 color_depth:4
|
|
mode 11: res:1280x720 hz:60 color_depth:8
|
|
mode 12: res:1440x900 hz:60 color_depth:4
|
|
mode 13: res:1440x900 hz:60 color_depth:8
|
|
mode 14: res:1680x1050 hz:60 color_depth:4
|
|
mode 15: res:1680x1050 hz:60 color_depth:8
|
|
mode 16: res:1920x1080 hz:60 color_depth:4
|
|
mode 17: res:1920x1080 hz:60 color_depth:8
|
|
mode 18: res:1920x1200 hz:60 color_depth:4
|
|
mode 19: res:1920x1200 hz:60 color_depth:8
|
|
mode 20: res:2560x1440 hz:60 color_depth:4
|
|
mode 21: res:2560x1440 hz:60 color_depth:8
|
|
mode 22: res:2560x1600 hz:60 color_depth:4
|
|
mode 23: res:2560x1600 hz:60 color_depth:8
|
|
mode 24: res:1024x576 hz:60 color_depth:4
|
|
mode 25: res:1024x576 hz:60 color_depth:8
|
|
|
|
Execute the command below to set your screens to the current arrangement:
|
|
|
|
displayplacer "id:69784AF1-CD7D-B79B-E5D4-60D937407F68 res:1024x768 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0"
|
|
|
|
# Lastly, set the display resolution. We will choose 1440x900
|
|
displayplacer "id:69784AF1-CD7D-B79B-E5D4-60D937407F68 res:1440x900 or
|
|
```
|