Skip to content

GeoffWilliams/aws_macos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS macOS

Run macOS in AWS for testing out systems macOS compatibility

All done with Terraform and ansible

How do you know to do this?

Easy! I follow Tony on YouTube 😂

Prerequisites

  1. You must allow dedicated mac1/mac2 quotas for EC2: mac1/mac2 quotas
  2. Copy terraform/terraform.tfvars.example to terraform/terraform.tfvars and adjust as needed

Create a macOS box accessible via SSH

cd terraform

# one time
# terraform init

terraform apply

Paste the sshconfig output into ~/.ssh/config and then login to the macOS by ssh:

ssh macos

GUI access

Since most macOS programs are GUI apps, its just about impossible to do all tasks over SSH so we must enable VNC and access via a tunnel. Set this up with Ansible:

cd ansible

# test connectivity - wait a few mins for host to alive
ansible -m ping all -i hosts.yml

ansible-playbook -i hosts.yml playbooks/vnc.yml

Now SSH to the box and open an SSH tunnel:

ssh -L 5900:localhost:5900 macos

# set a password we need it for VNC
sudo /usr/bin/dscl . -passwd /Users/ec2-user

Finally, you can connect via VNC:

  • Client software for Linux: Remmina
  • Server: localhost
  • Port: 5900
  • Username: ec2-user
  • Password: whatever you just set

"Enjoy"!

macos desktop

What Next?

  1. Apps + Confluent SDK/CLI
  2. Docker with bridge networking
  3. K3D with with accessible load balancers

Cleanup

  • Shutting down EC2 mac instances takes 10 minutes+ - this will fail the terraform script
  • Need to "release" the EC2 dedicated host to stop being billed (in 24hr increments)
  • Sometimes it take half hour or so for the EC2 host to realize its no longer occupied
  • Be patient and re-run terraform after some time or just release with the AWS console
cd terraform
terraform destroy

About

How to run macOS on AWS - working example

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published