Is there a minimal aws cli installation?

Sometimes I'd like to spin up an instance and run an aws cli command on it quickly, but there seems to be a great delay in installing the aws cli. Is there any way to get a "minimal" installation that omits the many files unnecessary in an automated deploy/test, for example all the example files? Or maybe even versions of the cli that only contain a single command, such as s3 or ec2?

Note that the instances are not running in AWS EC2, and I don't have control over the images, or I would use images with the AWS CLI pre-installed. Also note that the services I need to use are S3 and CloudFront.


Solution 1:

I don't think so, most of the dependencies are used by most of the AWS CLI commands I'd suspect so installing a trimmed down version won't really help much.

But you can either:

  1. Use an AMI that comes with AWS CLI already installed - e.g. Amazon Linux 2

  2. Create your own AMI with AWS CLI installed and use that as your base image - simply spin up an instance from the image of your choice, install AWS CLI, do Create Image (= creates a new AMI) and use that for your experiments.

  3. Use service-specific tools such as s3cmd or EB CLI that may require fewer dependencies.

Hope that helps :)

Solution 2:

Assuming you can run a container you could use the AWS CLI version 2 Docker image. After the image is pulled the first time the container launches and runs aws quickly.

Solution 3:

Have you considered AWS Cloud Shell? It's free, has AWS CLI pre-installed, and after the initial launch I think it opens quite quickly.

Your question doesn't say what you're trying to achieve, just how you're trying to achieve it, so it's difficult to know for sure if this is going to help.