Ben Oram

Quick notes on tech, AWS, .NET & containers

macos

| 1 min read

AWS Copilot currently doesn’t have support for leveraging docker buildx to allow for multi-architecture docker builds. So the arm64 images created on your M1 Mac with Apple Silicon will not work on AWS Fargate which is based on amd64 today. The error I was seeing in the CloudWatch logs for my load balanced web services was…

standard_init_linux.go:219: exec user process caused: exec format error

As a workaround, specify an arm64 version/tag of your "from" image in your Dockerfile. While this won’t create a multi-architecture image, it will force the creation of an images that will work with AWS Fargate. An example is below for NGINX.

FROM amd64/nginx:alpine
EXPOSE 80
COPY . /usr/share/nginx/html

| 1 min read

I ran into an issue with my EC2 macOS setup where running docker login from SSH resulted in the following error

Error saving credentials: error storing credentials - err: exit status 1, out: `User interaction is not allowed.`

Working around the issue involved running the following in my SSH session before running docker login

security unlock-keychain ${HOME}/Library/Keychains/login.keychain-db 

In subsequent sessions you may see an unknown: Authentication is required error. To avoid, run the unlock-keychain command again.


| 2 min read

I had a chance this week to run macOS on AWS EC2 . First impression, it is expensive and boot/reboot times are very slow. In my case I wanted some dev boxes to hand over to an engineer and I didn’t want to pull out my credit card. I was able to spin up an EC2 instance for each of the 3 most recent versions of MacOS in less than 30 minutes.

If you want to use VNC/Screen Sharing, you will need to run the following two commands to set a password and enable remote management.

# Set pasword
sudo passwd ec2-user

# Enable VNC access
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart \
-activate -configure -access -on \
-restart -agent -privs -all

# Fixup the disk to make the full EBS volume available
PDISK=$(diskutil list physical external | head -n1 | cut -d" " -f1)
APFSCONT=$(diskutil list physical external | grep "Apple_APFS" | tr -s " " | cut -d" " -f8)
yes | sudo diskutil repairDisk $PDISK

sudo diskutil apfs resizeContainer $APFSCONT 0

Overall MacStadium is much more cost-effective, they know Macs and they have M1. But if you want something running within AWS, your VPC, or in regions where MacStadium doesn’t yet exist and you are ok with Intel, Mac on EC2 works just fine.

References