amazon-ssm-agent icon indicating copy to clipboard operation
amazon-ssm-agent copied to clipboard

error: unknown command "s3", see 'snap help'

Open missinglink opened this issue 8 years ago • 2 comments

Hi, I hope this is the right place to report this :)

I'm running an AMI based off ubuntu-bionic-18.04-amd64-server- latest which is running scripts on startup.

The orchestration is managed by terraform using cloud_init. The scripts use the aws command to execute tasks against s3 such as uploading and downloading data.

I am having intermittent failures running commands such as:

/snap/bin/aws s3 cp s3://x y

error: unknown command "s3", see 'snap help'

The failure is intermittent, I can rerun the exact same configuration and it's a coin-flip as to whether the command is available or not.

It seems most likely that it's a race condition between whatever installs /snap/bin/aws and my cloud_init scripts.

I have only seen failures when running /snap/bin/aws as one of the first commands in my script.

For tasks using /snap/bin/aws later down the script file, it always works, because by that time the binary is available.

Is there any way I can configure my AMI to be consistent, I am using packer to create the AMI so I could presumably 'bake in' the command, but it seems like something is magically running on startup.

Alternatively, is there a way I can wait for the snaps to be installed before running scripts which depend on them?

Thanks!

missinglink avatar Aug 17 '18 13:08 missinglink

Hello Peter, I think the issue is not related to amazon-ssm-agent, can you please post in AWS forms to get maybe faster response regarding the issue? Thank you!

nehalaws avatar Aug 23 '18 22:08 nehalaws

I realise this issue was created 7 years ago, and not relevant to this project, but I ran into it today too, and this was the only relevant page on the web. Including my solution here for fellow people searching the Internet.

Instead of using snap for installing the aws cli, use the official installer:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

More info: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

jesseskinner avatar Jun 26 '25 11:06 jesseskinner