Skip to content

Repository storing all of our scripts used for the Anka Community and Marketplace AMIs automation.

Notifications You must be signed in to change notification settings

veertuinc/aws-ec2-mac-amis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Veertu's AWS EC2 AMI Prep Scripts

All AMIs are built from the default AWS AMIs.

The macOS AMI is an EBS-backed, AWS-supported image. This AMI includes the AWS Command Line Interface, Command Line Tools for Xcode, Amazon SSM Agent, and Homebrew. The AWS Homebrew Tap includes the latest versions of multiple AWS packages included in the AMI.

Root device type: ebs | Virtualization type: hvm | ENA Enabled: Yes

What we add, regardless of macOS version:

Prepare an AMI

The official Veertu AMIs in AWS have these steps already performed inside of them:

  • ALWAYS USE unset HISTFILE; at the end of commands
  1. cd /Users/ec2-user && git clone https://github.com/veertuinc/aws-ec2-mac-amis.git && cd aws-ec2-mac-amis && ANKA_LICENSE="skip" ./$(sw_vers | grep ProductVersion | cut -d: -f2 | xargs)/prepare.bash; unset HISTFILE
  2. Resizing of the disk may take a while. The instance may seem stuck, so be patient and only create the AMI once it's done (check /var/log/resize-disk.log to confirm)
  3. Test anka create using generate getting-started scripts + delete VM it creates after starting and running command inside
  4. Ensure cloud connect service works with user-data
  5. Restart without user-data
  6. As user AND root (only if you're going to make the AMI public):
    anka registry delete --all;
    anka delete --yes --all;
    echo "" | tee /Library/Logs/Anka/anka.log; 
    echo "" | tee /var/log/cloud-connect.log;
    echo "" | tee /var/log/resize-disk.log; 
    rm -f ~/.ssh/authorized_keys; 
    rm -f ~/.*_history; 
    history -p;
    rm -rf /tmp/anka-mac-resources; 
    rm -rf /Applications/Install*;
    rm -rf ~/.zsh_*;
    find "$(anka config img_lib_dir)" -mindepth 1 -delete;
    find "$(anka config state_lib_dir)" -mindepth 1 -delete;
    find "$(anka config vm_lib_dir)" -mindepth 1 -delete;
    unset HISTFILE;
  7. Remove license sudo anka license remove

This should install everything you need (the script is idempotent). You can then sanity check and then save the AMI.

Logs

  • /var/log/resize-disk.log
  • /var/log/cloud-connect.log

Usage of AMI

Please see the documentaion!

About

Repository storing all of our scripts used for the Anka Community and Marketplace AMIs automation.

Topics

Resources

Code of conduct

Security policy

Stars

Watchers

Forks

Languages