{"id":25013,"date":"2023-02-09T04:58:33","date_gmt":"2023-02-09T04:58:33","guid":{"rendered":"http:\/\/localhost\/helpold\/?p=24356"},"modified":"2026-08-16T21:59:54","modified_gmt":"2026-08-16T18:29:54","slug":"how-to-use-s3cmd-in-arvancloud","status":"publish","type":"post","link":"https:\/\/www.arvancloud.ir\/help\/en\/how-to-use-s3cmd-in-arvancloud\/","title":{"rendered":"How to Use S3cmd in ArvanCloud"},"content":{"rendered":"<p dir=\"ltr\">In this guide, we will learn how to use s3cmd as a client for ArvanCloud. S3cmd is a tool that allows you to create, list, or delete buckets from the terminal and download, upload, and delete objects to\/from your bucket.<\/p>\n<h2 dir=\"ltr\">Installing S3cmd<\/h2>\n<p dir=\"ltr\">You can install S3cmd from the command line using your Linux distribution&#8217;s Package Manager.<\/p>\n<p dir=\"ltr\">Enter the following command to update and upgrade your packages:<\/p>\n<pre><code>apt update &amp;&amp; apt upgrade -y<\/code><\/pre>\n<p dir=\"ltr\">Enter the following command to install s3cmd:<\/p>\n<pre><code>apt install s3cmd<\/code><\/pre>\n<h2 dir=\"ltr\">S3cmd Configuration<\/h2>\n<p dir=\"ltr\">Create a configuration file called .s3cfg in the HOME directory:<\/p>\n<pre><code>cd $HOME\r\ntouch .s3cfg<\/code><\/pre>\n<p dir=\"ltr\">Open the file with a text editor like nano:<\/p>\n<pre><code>nano .s3cfg<\/code><\/pre>\n<p dir=\"ltr\">Copy and paste the following text into the file, then save and close it. Note that you must replace the Access Key and Secret Key values with your own, which are available in the dashboard of your user panel.<\/p>\n<pre><code>[default]\r\n# Login credentials\r\naccess_key = &lt;ACCESS_KEY&gt;\r\nsecret_key = &lt;SECRET_KEY&gt;\r\nhost_base = https:\/\/s3.ir-thr-at1.arvanstorage.ir\r\nhost_bucket = https:\/\/s3.ir-thr-at1.arvanstorage.ir\r\nuse_https = True<\/code><\/pre>\n<p dir=\"ltr\">An alternative solution to creating a configuration file is to use the s3cmd &#8211;configure command.<\/p>\n<h2 dir=\"ltr\">Using Object Storage with S3cmd<\/h2>\n<p dir=\"ltr\">The features available in the Object Storage user panel or tools such as S3browser can be easily implemented with the help of S3cmd. In the following, we will examine the commands related to working with ArvanCloud Object Storage using S3cmd.<\/p>\n<h3 dir=\"ltr\">Creating a New Bucket<\/h3>\n<p dir=\"ltr\">Enter the following command to create a new bucket. Be careful that the bucket&#8217;s name must be a unique combination of numbers and small letters. Here we have chosen the name \u201cnewbucket\u201d.<\/p>\n<pre><code>s3cmd mb s3:\/\/newbucket<\/code><\/pre>\n<p dir=\"ltr\">The output of the command will be similar to the following:<\/p>\n<pre><code>Bucket 's3:\/\/newbucket\/' created<\/code><\/pre>\n<h3 dir=\"ltr\">Uploading Files to a Bucket<\/h3>\n<p dir=\"ltr\">You can use the following command to upload the file to the bucket:<\/p>\n<pre><code>s3cmd put logs.txt photo1.jpg s3:\/\/newbucket<\/code><\/pre>\n<p dir=\"ltr\">The output of this command will be as follows:<\/p>\n<pre><code>logs.txt -&gt; s3:\/\/newbucket\/logs.txt [1 of 2]\r\n0 of 0 0% in 0s 0.00 B\/s done\r\nphoto1.jpg -&gt; s3:\/\/newbucket\/photo1.jpg [2 of 2]\r\n0 of 0 0% in 0s 0.00 B\/s done<\/code><\/pre>\n<h3 dir=\"ltr\">Listing Files in a Bucket<\/h3>\n<p dir=\"ltr\">To view the list of files in a bucket, use the following command. Here we list all the files in the \u201cnewbucket\u201d bucket:<\/p>\n<pre><code>s3cmd ls s3:\/\/newbucket<\/code><\/pre>\n<p dir=\"ltr\">You should see an output similar to the following, which includes the files inside the bucket:<\/p>\n<pre><code>2021-07-10 06:23 0 s3:\/\/newbucket\/logs.txt\r\n2021-07-10 06:23 0 s3:\/\/newbucket\/photo1.jpg<\/code><\/pre>\n<h3 dir=\"ltr\">Downloading a File from the Bucket<\/h3>\n<p dir=\"ltr\">Use the following command to download an object from the bucket to your system. For example, here we downloaded the logs.txt file from \u201cnewbucket\u201d:<\/p>\n<pre><code>s3cmd get s3:\/\/newbucket\/logs.txt logs.txt<\/code><\/pre>\n<p dir=\"ltr\">The output will be as follows:<\/p>\n<pre><code>s3:\/\/newbucket\/logs.txt -&gt; logs.txt [1 of 1]\r\n0 of 0 0% in 0s 0.00 B\/s done<\/code><\/pre>\n<h3 dir=\"ltr\">Removing a File from the Bucket<\/h3>\n<p dir=\"ltr\">You can use the following command to delete a file from the bucket. For example, here we delete the logs.txt file from the \u201cnewbucket\u201d:<\/p>\n<pre><code>s3cmd del s3:\/\/newbucket\/logs.txt<\/code><\/pre>\n<p dir=\"ltr\">You should see the output as follows:<\/p>\n<pre><code>delete: 's3:\/\/newbucket\/logs.txt'<\/code><\/pre>\n<h3 dir=\"ltr\">Deleting a Bucket<\/h3>\n<p dir=\"ltr\">To delete a bucket, use the following command. Here we delete \u201cnewbucket\u201d:<\/p>\n<pre><code>s3cmd rb s3:\/\/newbucket<\/code><\/pre>\n<p dir=\"ltr\">The output will be similar to the following:<\/p>\n<pre><code>Bucket 's3:\/\/newbucket\/' removed<\/code><\/pre>\n<h2 dir=\"ltr\">CORS Configuration<\/h2>\n<p dir=\"ltr\">The <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cross-origin_resource_sharing\" rel=\"nofollow noopener\" target=\"_blank\">CORS<\/a> standard allows browsers to request resources from other domains if they have permission. This feature helps you configure how your buckets are accessed from browser-based apps and websites.<\/p>\n<h3 dir=\"ltr\">Setting the CORS Configuration on a Bucket<\/h3>\n<p dir=\"ltr\">Create a CORS configuration file and open it with a text editor:<\/p>\n<pre><code>nano cors.xml<\/code><\/pre>\n<p dir=\"ltr\">Put your settings and configuration in the file, save and close it:<\/p>\n<pre><code>&lt;CORSConfiguration&gt;\r\n&lt;CORSRule&gt;\r\n   &lt;AllowedOrigin&gt;http:\/\/www.example.com&lt;\/AllowedOrigin&gt;\r\n   &lt;AllowedMethod&gt;PUT&lt;\/AllowedMethod&gt;\r\n   &lt;AllowedMethod&gt;POST&lt;\/AllowedMethod&gt;\r\n   &lt;AllowedMethod&gt;DELETE&lt;\/AllowedMethod&gt;\r\n   &lt;AllowedHeader&gt;*&lt;\/AllowedHeader&gt;\r\n   &lt;MaxAgeSeconds&gt;3000&lt;\/MaxAgeSeconds&gt;\r\n   &lt;ExposeHeader&gt;x-server-side-encryption&lt;\/ExposeHeader&gt;\r\n&lt;\/CORSRule&gt;\r\n&lt;\/CORSConfiguration&gt;<\/code><\/pre>\n<p dir=\"ltr\">Use the following command and replace your bucket name with \u201cbucketname\u201d to set this information on it.<\/p>\n<pre><code>s3cmd setcors cors.xml s3:\/\/bucketname<\/code><\/pre>\n<h3 dir=\"ltr\">Removing CORS Settings from a Bucket<\/h3>\n<p dir=\"ltr\">Run the following command to remove the CORS configuration of a bucket. Replace your bucket name with \u201cbucketname\u201d:<\/p>\n<pre><code>s3cmd delcors s3:\/\/bucketname<\/code><\/pre>\n<h2 dir=\"ltr\">Other Commands<\/h2>\n<p dir=\"ltr\">For more information about the various s3cmd commands, refer to the official documentation by running the \u201cs3cmd &#8211;help\u201d command.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this guide, we will learn how to use s3cmd as a client for ArvanCloud. S3cmd is a tool that allows you to create, list, or delete buckets from the terminal and download, upload, and delete objects to\/from your bucket. Installing S3cmd You can install S3cmd from the command line using your Linux distribution&#8217;s Package [&hellip;]<\/p>\n","protected":false},"author":79,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"r1_post_views_count":"636","feedback_yes":"0","feedback_no":"","ads_id_sidebar":"","ads_id_content":"","footnotes":""},"categories":[247,269],"tags":[],"class_list":["post-25013","post","type-post","status-publish","format-standard","hentry","category-cloud-storage","category-file-management"],"lang":"en","translations":{"en":25013},"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts\/25013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/users\/79"}],"replies":[{"embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/comments?post=25013"}],"version-history":[{"count":2,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts\/25013\/revisions"}],"predecessor-version":[{"id":29428,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/posts\/25013\/revisions\/29428"}],"wp:attachment":[{"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/media?parent=25013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/categories?post=25013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.arvancloud.ir\/help\/wp-json\/wp\/v2\/tags?post=25013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}