diff --git a/bin/amiize.sh b/bin/amiize.sh index 1fb7427a27e..fdbf9e7d317 100755 --- a/bin/amiize.sh +++ b/bin/amiize.sh @@ -118,7 +118,7 @@ Required: --ssh-keypair The SSH keypair name that's registered with EC2, to connect to worker instance --instance-type Instance type launched for worker instance --name The name under which to register the AMI - --arch The machine architecture of the AMI, e.g. x86_64 + --arch The machine architecture of the AMI, e.g. x86_64, arm64 Optional: --description The description attached to the registered AMI (defaults to name) @@ -187,6 +187,20 @@ parse_args() { required_arg "--name" "${NAME}" required_arg "--arch" "${ARCH}" + # Validate and canonicalize architecture identifier. + case "${ARCH,,}" in + arm64|aarch64) + ARCH=arm64 + ;; + x86_64|amd64) + ARCH=x86_64 + ;; + *) + echo "ERROR: Unsupported EC2 machine architecture: $ARCH" >&2 + usage + exit 2 + esac + # Other argument checks if [ ! -r "${ROOT_IMAGE}" ] ; then echo "ERROR: cannot read ${ROOT_IMAGE}" >&2