aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

ecs execute-command fails silently on Apple Silicon (M1)

Open jfirebaugh opened this issue 2 years ago • 3 comments

Describe the bug

session-manager-plugin does not supply an aarch64 build. Running it directly on Apple Silicon (without Rosetta 2 installed) produces the error "bad CPU type in executable: session-manager-plugin".

aws-cli catches and ignores OSErrors from executing session-manager-plugin other than ENOENT:

https://github.com/aws/aws-cli/blob/e689fbc1daeae63c6b255c5a12a31f35b1fa37c7/awscli/customizations/ecs/executecommand.py#L113-L117

The "bad CPU type" is an OSError, but not ENOENT. This means that on Apple Silicon aws ecs execute-command ... silently does nothing; it just drops you back to the shell with no indication of the underlying issue.

Expected Behavior

aws ecs execute-command ... should execute the command. Or, until https://github.com/aws/session-manager-plugin/issues/26 is fixed, it should at least give you a hint of why it fails.

Current Behavior

aws ecs execute-command ... fails silently.

Reproduction Steps

Obtain an M1 Mac. Do not install Rosetta 2. Install session-manager-plugin, e.g. via brew install session-manager-plugin. Run some aws ecs execute-command ... command.

Possible Solution

No response

Additional Information/Context

No response

CLI version used

aws-cli/2.7.23 Python/3.10.6 Darwin/21.6.0 source/arm64 prompt/off

Environment details (OS name and version, etc.)

macOS 12.5.1

jfirebaugh avatar Aug 23 '22 02:08 jfirebaugh

Hi @jfirebaugh thanks for reaching out. Customizations are owned by service teams so I'll try reaching out to the Session Manager team to get their thoughts on this.

tim-finnigan avatar Aug 23 '22 17:08 tim-finnigan

Very keen to get a solution to this, and to know if there are any workarounds in the short term

jonodrew avatar Aug 24 '22 08:08 jonodrew

One workaround is to install Rosetta 2 (softwareupdate --install-rosetta --agree-to-license). I personally avoid doing that because I need to ensure that software I'm responsible for supporting runs natively on Apple Silicon, and installing Rosetta 2 would make it too easy for an Intel-only binary to slip through.

jfirebaugh avatar Aug 24 '22 16:08 jfirebaugh

I am experiencing the same issue on an intel mac.

OSX 12.6.1 Macbook Pro 16' - 6-Core Intel Core i7

➜  Desktop aws --version
aws-cli/2.9.6 Python/3.9.11 Darwin/21.6.0 exe/x86_64 prompt/off
➜  Desktop aws ecs execute-command  --profile user1 --cluster 123 --task 123 --container web --command "/bin/bash" --interactive                                                                            
➜  Desktop 

As you can see, the IDs are wrong but nothing happens.

alexisgaziello avatar Dec 14 '22 12:12 alexisgaziello

This problem also affects Session Manager, e.g. with aws ssm start-session ...

thyming avatar Feb 08 '23 18:02 thyming

Version 1.2.463.0 of the session-manage-plugin includes support ARM64 for Apple Mac M1. I think this can now be closed.

tim-finnigan avatar Nov 02 '23 17:11 tim-finnigan