{"id":2626,"date":"2018-10-06T12:27:33","date_gmt":"2018-10-06T06:57:33","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2626"},"modified":"2026-09-27T16:45:51","modified_gmt":"2026-09-27T11:15:51","slug":"using-aws-command-line-interfaceaws-cli-for-accessing-s3-bucket","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/using-aws-command-line-interfaceaws-cli-for-accessing-s3-bucket\/","title":{"rendered":"Using AWS Command Line Interface[AWS-CLI] for accessing S3 bucket."},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Post Date: October 6, 2018 <br>Last Updated: September 27, 2026<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide explains how to install and use the AWS Command Line Interface (AWS CLI) to access and manage an S3 bucket \u2014 uploading, downloading, syncing, and managing objects directly from the terminal.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One important update from the original version of this guide: it installed <strong>AWS CLI v1<\/strong> via <code>pip<\/code>. AWS now recommends <strong>AWS CLI v2<\/strong> \u2014 a self-contained installer that doesn&#8217;t depend on Python at all, receives ongoing feature updates, and is the version AWS documents by default going forward. The steps below use the current v2 installation method.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A Linux, macOS, or Windows machine with terminal access<\/li>\n\n\n\n<li>An AWS account with an IAM user (or role) that has S3 permissions<\/li>\n\n\n\n<li>That user&#8217;s Access Key ID and Secret Access Key<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Architecture<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The <strong>AWS CLI<\/strong> is a client \u2014 it doesn&#8217;t store anything itself, it just sends authenticated API requests to AWS<\/li>\n\n\n\n<li>Your <strong>credentials<\/strong> (Access Key ID + Secret Access Key) authenticate every request<\/li>\n\n\n\n<li>Each command maps to an underlying <strong>S3 API call<\/strong> \u2014 <code>aws s3 cp<\/code> uploads\/downloads objects, <code>aws s3 ls<\/code> lists them, <code>aws s3 sync<\/code> reconciles a local folder and a bucket<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM.png\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"512\" src=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM-1024x512.png\" alt=\"\" class=\"wp-image-11948\" srcset=\"https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM-1024x512.png 1024w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM-300x150.png 300w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM-768x384.png 768w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM-1536x768.png 1536w, https:\/\/pheonixsolutions.com\/blog\/wp-content\/uploads\/2018\/10\/ChatGPT-Image-Sep-27-2026-04_43_11-PM.png 1774w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Steps<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">1. Install AWS CLI v2<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Linux:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl \"https:\/\/awscli.amazonaws.com\/awscli-exe-linux-x86_64.zip\" -o \"awscliv2.zip\"\nunzip awscliv2.zip\nsudo .\/aws\/install\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>macOS:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">curl \"https:\/\/awscli.amazonaws.com\/AWSCLIV2.pkg\" -o \"AWSCLIV2.pkg\"\nsudo installer -pkg AWSCLIV2.pkg -target \/\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> The original guide installed AWS CLI v1 via Python and <code>pip<\/code> (<code>curl get-pip.py<\/code>, then <code>pip install awscli<\/code>). That method still technically works, but AWS CLI v2 is now the recommended version \u2014 it&#8217;s a standalone installer with no Python dependency, and gets ongoing feature updates that v1 generally doesn&#8217;t.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">2. Verify the Installation<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws --version\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see output confirming an <code>aws-cli\/2.x<\/code> version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Configure Your Credentials<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws configure\n<\/pre>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">AWS Access Key ID [None]: &lt;your access key>\nAWS Secret Access Key [None]: &lt;your secret key>\nDefault region name [None]: us-east-2\nDefault output format [None]: json\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Security note:<\/strong> Never share or commit these keys anywhere public. If you&#8217;re working on a shared or long-lived server, consider using an IAM role instead of static keys where possible.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">4. Create a Bucket<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws s3 mb s3:\/\/your-bucket-name\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5. Upload a File to the Bucket<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws s3 cp .\/tests.txt s3:\/\/your-bucket-name\/folder\/\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">6. List Your Buckets<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws s3 ls\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. Remove a Bucket<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws s3 rb s3:\/\/your-bucket-name\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">If the bucket name doesn&#8217;t match exactly, you&#8217;ll get a <code>NoSuchBucket<\/code> error \u2014 double-check the name against your <code>aws s3 ls<\/code> output first.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">8. Sync a Local Folder with a Bucket<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws s3 sync .\/local-folder s3:\/\/your-bucket-name\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>sync<\/code> reconciles the contents of a local folder and a bucket (or two buckets), only transferring files that have actually changed \u2014 more efficient than re-uploading everything with <code>cp<\/code> each time.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">9. Grant Specific Permissions on Upload (Optional)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>cp<\/code>, <code>mv<\/code>, and <code>sync<\/code> support a <code>--grants<\/code> option to set permissions on objects as they&#8217;re uploaded:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">aws s3 cp .\/file.txt s3:\/\/your-bucket-name\/ --grants read=uri=http:\/\/acs.amazonaws.com\/groups\/global\/AllUsers\n<\/pre>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Field<\/th><th>Options<\/th><\/tr><\/thead><tbody><tr><td>Permission<\/td><td><code>read<\/code>, <code>readacl<\/code>, <code>writeacl<\/code>, <code>full<\/code><\/td><\/tr><tr><td>Grantee_Type<\/td><td><code>uri<\/code>, <code>emailaddress<\/code>, <code>id<\/code><\/td><\/tr><tr><td>Grantee_ID<\/td><td>The actual URI, email, or canonical ID matching the type above<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Managing S3 from the command line comes down to installing AWS CLI v2 (rather than the older pip-based v1 method), configuring your credentials once, and using a small set of commands \u2014 <code>cp<\/code>, <code>ls<\/code>, <code>rb<\/code>, <code>sync<\/code> \u2014 that map directly to S3 operations. <code>sync<\/code> in particular is worth knowing well, since it avoids re-uploading unchanged files every time.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Is AWS CLI v1 still usable?<\/strong> Yes, but AWS recommends v2 for new setups \u2014 it&#8217;s actively maintained with new features, while v1 is considered legacy.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Do I need Python installed for AWS CLI v2?<\/strong> No \u2014 that&#8217;s one of the main differences from v1. AWS CLI v2 is a self-contained installer with no Python dependency.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>What&#8217;s the difference between cp and sync?<\/strong> <code>cp<\/code> copies a specific file or folder every time you run it, re-uploading everything. <code>sync<\/code> compares source and destination first and only transfers what&#8217;s actually changed, which is much faster for repeated backups.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-create-an-aws-s3-bucket-using-terraform\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Create an AWS S3 Bucket Using Terraform<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/blog\/how-to-mount-wasabi-storage-bucket-on-centos-and-ubuntu-20-using-s3fs\/\" target=\"_blank\" rel=\"noreferrer noopener\">How to Mount Wasabi Storage Bucket on CentOS and Ubuntu 20 using S3FS<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Managing cloud storage or building out your AWS infrastructure? Our team can help with cloud architecture, S3 automation, and ongoing AWS support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post Date: October 6, 2018 Last Updated: September 27, 2026 Introduction This guide explains how to install and use the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[426,434],"class_list":["post-2626","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-aws-cli-commands-to-access-s3-bucket","tag-aws-cli-for-s3-bucket","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-Gm","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2626"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2626\/revisions"}],"predecessor-version":[{"id":11949,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2626\/revisions\/11949"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}