Why does the AWS CLI take so long to install?


I've been sitting here waiting to SSH into my new instance for ten minutes and this thing is STILL installing. Why is it so painfully slow? This is insane.

Created in launch template with script:

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

There's not a lot to go on here - which one of the three commands is taking the longest? I just ran them on a new instance and the first two completed in under 10 seconds; the installation didn't take much longer than that.

profile pictureAWS
answered a year ago
  • The install. I can see it inflating and creating stuff in the serial console. It just takes forever. This is not a big install, why is it so incredibly slow?

  • There's a lot of text output from the installation process. Serial interfaces are not fast (well, as fast as SSH is for example) so the time taken may not be as long as you think - it may be that the output is being buffered because of the speed of the interface. I'd try using SSH instead or piping the output to /dev/null.

  • That would have been a neat conclusion, but sadly it is actually taking all that time - I am blocked from SSH until it completes, about 12 minutes ("error: server refused our key"). Once it's done I can ssh in. Plus the console is just a log of the actual server events, so the times reported are accurate for the server (if the instance says it was created at 12:03 and the console it says it completed the install at 12:15 it did actually complete at 12:15 and take 12 minutes even if that is displayed in the console viewer at 12:30).

  • What type of instance are you using?


I noticed this problem as well on an EC2 instance running Ubuntu. We install the aws cli during cloud-init, where I observed that unzipping the file took 8 minutes.

2023-09-15T08:39:25+00:00 [INFO] unzip awscli
2023-09-15T08:47:03+00:00 [INFO] install awscli <-- notice the large ts gap here
2023-09-15T08:47:05+00:00 [OK] Installed AWS CLI

My theory is that this is due to expensive IO operations (either to disk, network or both).

When I changed the unzip command to quiet mode, it took a much more reasonable amount of time.

-unzip awscliv2.zip
+unzip -qq awscliv2.zip
2023-09-15T09:02:04+00:00 [INFO] unzip awscli
2023-09-15T09:02:07+00:00 [INFO] install awscli
2023-09-15T09:02:09+00:00 [OK] Installed AWS CLI
profile picture
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions