{"id":134243,"date":"2023-04-15T20:32:37","date_gmt":"2023-04-15T17:32:37","guid":{"rendered":"https:\/\/computingforgeeks.com\/?p=134243"},"modified":"2024-03-11T13:50:22","modified_gmt":"2024-03-11T10:50:22","slug":"install-and-use-aws-cli-on-linux-mint-macos","status":"publish","type":"post","link":"https:\/\/computingforgeeks.com\/install-and-use-aws-cli-on-linux-mint-macos\/","title":{"rendered":"How To Install AWS CLI on Linux \/ macOS"},"content":{"rendered":"\n<p><strong>Cloud computing<\/strong> is one of the higly adopted technologies today. This model involves delivering computing resources over the internet, such as servers, storage, databases, applications, and other IT services. Rather than owning and maintaining physical servers and infrastructure, cloud computing allows users to access these resources on-demand, using a pay-per-use model, through a network of remote servers hosted on the internet. There are several features and benefits associated with cloud computing. The notable ones are cost savings, reliability, availability, global accessibility, scalability and flexibility. <\/p>\n\n\n\n<p>There are several cloud providers, they include Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP), IBM Cloud, Oracle Cloud, Alibaba Cloud etc. As a system administrator\/cloud engineer, you are tasked to provision and maintain the cloud resources. Most of these cloud providers allow their users to manage the resources from their web portals. However, most users prefer managing the resources from the command line. This gives them the freedom to automate tasks via the command line.<\/p>\n\n\n\n<p>The <strong>AWS Command Line Interface<\/strong> (CLI) is a unified tool that allows users to manage AWS services and resources from the command line. It provides a command-line interface from which users can interact with various AWS services, such as EC2 instances, RDS databases, S3 buckets, and many others, using a set of commands. It is built on top of the AWS SDKs (Software Development Kits), which are available in various programming languages. It provides a simple, yet powerful way to interact with AWS services without the need for a graphical user interface (GUI).<\/p>\n\n\n\n<p>It offers several features and benefits to AWS users, among them are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Automation<\/strong>: users can automate and script various tasks, such as deploying applications, creating and managing AWS resources, and configuring security settings. You can use scripts to automate these tasks, which can save time and reduce the risk of errors.<\/li>\n\n\n\n<li><strong>Cross-platform<\/strong>: It supports a wide range of operating systems, including Windows, macOS, and Linux, and can be easily installed and configured on any machine.<\/li>\n\n\n\n<li><strong>Security<\/strong>: The AWS CLI provides secure access to AWS resources. You can use AWS Identity and Access Management (IAM) to control access to resources, and you can encrypt data in transit and at rest.<\/li>\n\n\n\n<li><strong>Speed and efficiency<\/strong>: With the AWS CLI, you can perform tasks quickly and efficiently. You can use simple commands to perform complex tasks, and you can easily script repetitive tasks to save time.<\/li>\n\n\n\n<li><strong>Flexibility<\/strong>: The AWS CLI is available on multiple platforms, including Windows, Linux, and macOS. You can use it with a variety of programming languages, including Python, Ruby, and Node.js.<\/li>\n\n\n\n<li><strong>Integration with other tools<\/strong>: The AWS CLI integrates with many other tools, including AWS CloudFormation, AWS CodeDeploy, and AWS CodePipeline. You can use it to automate your DevOps workflows and integrate with your existing tools and processes.<\/li>\n<\/ul>\n\n\n\n<p>Today we will walk through how to install and use AWS CLI on Linux | macOS.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Getting Started<\/h2>\n\n\n\n<p>The AWS CLI works with the below Python versions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>3.7.x and greater<\/li>\n\n\n\n<li>3.8.x and greater<\/li>\n\n\n\n<li>3.9.x and greater<\/li>\n\n\n\n<li>3.10.x and greater<\/li>\n\n\n\n<li>3.11.x and greater<\/li>\n<\/ul>\n\n\n\n<p>After the deprecation for Python 2.7 on 2021-01-15 support for this version was dropped and users were advised to upgrade their version of Python or pin the version of the AWS CLI. Also on 2022-05-30, support for Python 3.6 was ended after the Python Software Foundation announced the end of support for the runtime on 2021-12-23.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">1. Install AWS CLI on Linux | macOS<\/h2>\n\n\n\n<p>There are several methods to install the AWS CLI on Linux | macOS. In this guide, we will cover the below methods.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Method 1 &#8211; Install AWS CLI on Linux | macOS Using PIP<\/h3>\n\n\n\n<p>This is the most common and easiest method to install AWS CLI on Linux | macOS. For this method, it is recommended to have the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>pip<\/code>: 9.0.2 or greater<\/li>\n\n\n\n<li><code>setuptools<\/code>: 36.2.0 or greater<\/li>\n<\/ul>\n\n\n\n<p>Once the requirements have been met, you can install the AWS CLI in a <code>virtualenv<\/code> with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -m pip install awscli\n##OR\npython -m pip install awscli<\/code><\/pre>\n\n\n\n<p>If you are not using the <code>virtualenv<\/code>, then you can do a global installation with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo python3 -m pip install awscli\n##OR\nsudo python -m pip install awscli<\/code><\/pre>\n\n\n\n<p>Sample execution output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"953\" height=\"788\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS.png\" alt=\"\" class=\"wp-image-134256\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS.png 953w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-300x248.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-768x635.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-696x575.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-508x420.png 508w\" sizes=\"auto, (max-width: 953px) 100vw, 953px\" \/><\/figure>\n\n\n\n<p>You can also install the CLI for a specific user:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -m pip install --user awscli\n##OR\npython -m pip install --user awscli<\/code><\/pre>\n\n\n\n<p>You can also upgrade to the latest available version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -m pip install --upgrade awscli\n##OR\npython -m pip install --upgrade awscli<\/code><\/pre>\n\n\n\n<p>During the installation on macOS, you can encounter an error regarding the version of&nbsp;<code>six<\/code>&nbsp;that came with&nbsp;<code>distutils<\/code>&nbsp;in El Capitan. To resolve this, use the <code>--ignore-installed<\/code>&nbsp;option as shown:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo python -m pip install awscli --ignore-installed six<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Method 2 &#8211; Install the AWS CLI using the bundled installer<\/h3>\n\n\n\n<p>You can use the bundled installer to install the AWS CLI version 1 from the command line on  Linux | macOS. You need to have <strong>Python<\/strong> and <strong>python-venv<\/strong> packages installed. Then, obtain the <strong>latest<\/strong> version of the AWS CLI with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl \"https:\/\/awscli.amazonaws.com\/awscli-exe-linux-x86_64.zip\" -o \"awscliv2.zip\"\nsudo .\/aws\/install<\/code><\/pre>\n\n\n\n<p>Extract the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>unzip awscliv2.zip<\/code><\/pre>\n\n\n\n<p>Now run the bundled installer:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo .\/aws\/install<\/code><\/pre>\n\n\n\n<p>The installer will install the AWS CLI at<strong><em> \/usr\/local\/aws<\/em><\/strong> and creates the symlink <strong>aws<\/strong> at the<strong><em> \/usr\/local\/bin <\/em><\/strong>directory. The -b option is used to create a symbolic link to allow the user to run the AWS CLI by entering <code>aws<\/code> from any directory.<\/p>\n\n\n\n<p>This installation will use the default Python version to run. If you have another Python installation for example <strong>Python3<\/strong>, you can specify it during the installation with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo \/usr\/bin\/python3 awscli-bundle\/install -i \/usr\/local\/aws -b \/usr\/local\/bin\/aws<\/code><\/pre>\n\n\n\n<p>Use the command below to identify the Python location:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>which python3\n##OR\nwhich python<\/code><\/pre>\n\n\n\n<p>Sample execution output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"99\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-1024x99.png\" alt=\"\" class=\"wp-image-134258\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-1024x99.png 1024w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-300x29.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-768x74.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-1536x148.png 1536w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-696x67.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2-1068x103.png 1068w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-2.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">2. Configure the AWS CLI on Linux | macOS<\/h2>\n\n\n\n<p>Once the installation is complete, verify the installed version with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">aws --version<\/mark>\naws-cli\/2.15.19 Python\/3.11.6 Linux\/5.10.205-195.807.amzn2.x86_64 botocore\/2.4.5<\/code><\/pre>\n\n\n\n<p>Before we use the AWS CLI, we are required to configure the AWS credentials. This can be achieved using a number of ways:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configuration command<\/li>\n\n\n\n<li>Environment variables<\/li>\n\n\n\n<li>Shared credentials file<\/li>\n\n\n\n<li>Config file<\/li>\n\n\n\n<li>IAM Role<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">a. Using the Configuration command<\/h3>\n\n\n\n<p>The easiest method of them all is by running the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">aws configure<\/mark>\nAWS Access Key ID: <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">MY_ACCESS_KEY<\/mark><\/em>\nAWS Secret Access Key: <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">MY_SECRET_KEY<\/mark><\/em>\nDefault region name &#91;us-west-2]: <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">eu-west-1<\/mark><\/em>\nDefault output format &#91;None]: <em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">json<\/mark><\/em><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">b. Using Environment variables<\/h3>\n\n\n\n<p>You can also configure the creds using environment variables as shown:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export AWS_ACCESS_KEY_ID=<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">&lt;access_key&gt;<\/mark>\nexport AWS_SECRET_ACCESS_KEY=<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">&lt;secret_key&gt;<\/mark><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">c. Using shared credentials file<\/h3>\n\n\n\n<p>This method involves creating an INI formatted file like this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ~\/.aws<\/code><\/pre>\n\n\n\n<p>Create the file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">vim ~\/.aws\/credentials<\/mark>\n&#91;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">default<\/mark>]\naws_access_key_id=<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">MYACCESSKEY<\/mark>\naws_secret_access_key=<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">MYSECRETKEY<\/mark>\n\n&#91;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\">testing<\/mark>]\naws_access_key_id=<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">MYACCESKEY<\/mark>\naws_secret_access_key=<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">MYSECRETKEY<\/mark><\/code><\/pre>\n\n\n\n<p>Replace all the variables appropriately. You can also place the shared credentials file in a different location than the one specified above and export the path with the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export AWS_SHARED_CREDENTIALS_FILE=<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-cyan-blue-color\">\/path\/to\/shared_credentials_file<\/mark><\/em><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">d. Using a Config File<\/h2>\n\n\n\n<p>This method almost resembles the shared credentials one.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir ~\/.aws<\/code><\/pre>\n\n\n\n<p> Create an INI formatted file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">vim ~\/.aws\/config<\/mark>\n&#91;default]\naws_access_key_id=&lt;default access key&gt;\naws_secret_access_key=&lt;default secret key&gt;\n# Optional, to define default region for this profile.\nregion=us-west-1\n\n&#91;profile testing]\naws_access_key_id=&lt;testing access key&gt;\naws_secret_access_key=&lt;testing secret key&gt;\nregion=us-west-2<\/code><\/pre>\n\n\n\n<p>If you used a different path for the file, export it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export AWS_CONFIG_FILE=<em><strong>\/path\/to\/config_file<\/strong><\/em><\/code><\/pre>\n\n\n\n<p>For both the shared credentials file and the configuration file we have multiple profiles specified. You can then specify the preferred profile for use with the<code> --profile<\/code> option. If not specified, then the &nbsp;<code>default<\/code>&nbsp;profile will be used.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">e. Using IAM Roles<\/h3>\n\n\n\n<p>This is the highly recommended method if you are using the AWS CLI on an EC2 instance. The &nbsp;<a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/iam-roles-for-amazon-ec2.html\" target=\"_blank\" rel=\"noreferrer noopener\">IAM Roles<\/a>&nbsp;are a great way to get the credentials automatically installed on your instance. <\/p>\n\n\n\n<p>If you are using IAM Roles, the AWS CLI will find and use them automatically. Moreso, a number of other variables can be configured either with environment variables, configuration file entries, or both. For more, refer to the <a href=\"https:\/\/docs.aws.amazon.com\/credref\/latest\/refdocs\/overview.html\" target=\"_blank\" rel=\"noreferrer noopener\">AWS Tools and SDKs Shared Configuration and Credentials Reference Guide<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">3. How to Use the AWS CLI on Linux | macOS<\/h2>\n\n\n\n<p>Now once the configurations have been made, you are set to use the AWS CLI on Linux | macOS to interact with the AWS resources. The AWS CLI command has the following syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws &lt;command&gt; &lt;subcommand&gt; &#91;options and parameters]<\/code><\/pre>\n\n\n\n<p>For example, to manage EC2 instances, use the commands:<\/p>\n\n\n\n<p>To list the instances<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws ec2 describe-instances<\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"670\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3.png\" alt=\"\" class=\"wp-image-134259\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3.png 925w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3-300x217.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3-768x556.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3-696x504.png 696w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3-580x420.png 580w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-3-324x235.png 324w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><\/figure>\n\n\n\n<p>To avoid a long output, you can filter to obtain the instance ID.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">aws ec2 describe-instances --filters \"Name=instance-type,Values=t2.micro\" --query \"Reservations&#91;].Instances&#91;].InstanceId\"<\/mark>\n&#91;\n    \"i-069533e79cd6fcfbb\"\n]<\/code><\/pre>\n\n\n\n<p>You can then terminate\/deletes the desired instance<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws ec2 terminate-instances --instance-ids<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-amber-color\"> i-069533e79cd6fcfbb<\/mark><\/code><\/pre>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"989\" height=\"367\" src=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-4.png\" alt=\"\" class=\"wp-image-134260\" title=\"\" srcset=\"https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-4.png 989w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-4-300x111.png 300w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-4-768x285.png 768w, https:\/\/computingforgeeks.com\/wp-content\/uploads\/2023\/03\/Install-and-Use-AWS-CLI-on-Linux-Mint-macOS-4-696x258.png 696w\" sizes=\"auto, (max-width: 989px) 100vw, 989px\" \/><\/figure>\n\n\n\n<p>To stop\/start the instance, use:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##START\n<\/mark><\/em>aws ec2 start-instances --instance-ids i-069533e79cd6fcfbb\n\n<em><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-purple-color\">##STOP\n<\/mark><\/em>aws ec2 stop-instances --instance-ids i-069533e79cd6fcfbb<\/code><\/pre>\n\n\n\n<p>Listing the S3 buckets, the command will be:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws s3 ls<\/code><\/pre>\n\n\n\n<p>You can also view the files in an S3 bucket. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">aws s3 ls s3:\/\/mybucket<\/mark>\n        LastWriteTime            Length Name\n        ------------             ------ ----\n                                PRE myfolder\/\n2013-09-03 10:00:00           1234 myfile.txt<\/code><\/pre>\n\n\n\n<p>You can perform recursive uploads and downloads in a single folder-level command. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\"> aws s3 cp <em>myfolder<\/em> <em>s3:\/\/mybucket\/myfolder --recursive<\/em><\/mark>\nupload: myfolder\/file1.txt to s3:\/\/mybucket\/myfolder\/file1.txt\nupload: myfolder\/subfolder\/file1.txt to s3:\/\/mybucket\/myfolder\/subfolder\/file1.txt<\/code><\/pre>\n\n\n\n<p>You can also sync files between the local folder and the S3 bucket. For example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-pale-pink-color\">aws s3 sync myfolder s3:\/\/mybucket\/myfolder --exclude *.tmp<\/mark>\nupload: myfolder\/newfile.txt to s3:\/\/mybucket\/myfolder\/newfile.txt<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Verdict<\/h2>\n\n\n\n<p>We have come to the end of this guide on how to install and use AWS CLI on Linux | macOS. You have the power to automate deployments on the AWS platform using the CLI tool. I hope this was significant to you.<\/p>\n\n\n\n<p>See more:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/computingforgeeks.com\/how-to-deploy-eks-cluster-on-aws-using-terraform\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Deploy EKS Cluster on AWS using Terraform<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/mount-aws-efs-file-system-on-ec2\/\" target=\"_blank\" rel=\"noreferrer noopener\">How To Mount AWS EFS File System on EC2 Instance<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/computingforgeeks.com\/automatically-update-ecs-services-using-codepipeline\/\" target=\"_blank\" rel=\"noreferrer noopener\">AWS ECS: Automatically Update ECS Services using CodePipeline<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Cloud computing is one of the higly adopted technologies today. This model involves delivering computing resources over the internet, such as servers, storage, databases, applications, and other IT services. Rather than owning and maintaining physical servers and infrastructure, cloud computing allows users to access these resources on-demand, using a pay-per-use model, through a network of &#8230; <a title=\"How To Install AWS CLI on Linux \/ macOS\" class=\"read-more\" href=\"https:\/\/computingforgeeks.com\/install-and-use-aws-cli-on-linux-mint-macos\/\" aria-label=\"Read more about How To Install AWS CLI on Linux \/ macOS\">Read more<\/a><\/p>\n","protected":false},"author":21,"featured_media":136140,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[511,2680,299,50,9275],"tags":[37722,38365,38366],"class_list":["post-134243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-aws","category-cloud","category-how-to","category-linux-tutorials","category-terminal","tag-aws-cli","tag-aws-cli-on-linux-mint","tag-aws-cli-on-macos"],"_links":{"self":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/134243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/comments?post=134243"}],"version-history":[{"count":0,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/posts\/134243\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media\/136140"}],"wp:attachment":[{"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/media?parent=134243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/categories?post=134243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/computingforgeeks.com\/wp-json\/wp\/v2\/tags?post=134243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}