How to: Install the AWS CLI on Ubuntu
By Aaron F. April 4th, 2016
The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
For more information & available commands, please see the AWS CLI documentation.
First things first, let's ensure our list of available packages is up to date. Run the following command:
Next, let's install the Python package management system:
Now let's install the AWS Command Line Interface (CLI):
As a final configuration step, you will need to create a plain text file within your home folder, with the following folder, and with the following name:
- If root user: /root/.aws/config
- If sudo user: /home/[USER NAME]/.aws/config
Reaplace [USER NAME] with your actual user name on the system.
Put the following content in the file named config from above:
Be sure to replace [ACCESS KEY] and [SECRET KEY] with your AWS access & secret keys. Also, change the region to match your preferred Amazon Web Services region.
Lastly, run the following command to lock down this file from prying eyes:
As an option, set a variable in your bashrc file (located at $HOME/.bashrc) pointing to the above configuration file. This is only required if you decide to store the above file outside of your home folder.
Add the following line to the end of the above file, ensuring proper path to your configuration file:
To check that everything is installed and working properly, run the following command. You should see a JSON list of all available EC2 instances:
There you have it! Your system is now fully configured and ready to interact with the AWS CLI.
Stay tuned for further articles & tutorials on interacting and using the AS CLI for various features & functions!
Topics: Amazon Web Services, Cloud Infrastructure, Platform Engineering