Purpose
This KB explains how to configure CMP S3 bucket storage on a Linux VM using:
- s3cmd for command-line S3 operations
- s3fs for mounting the S3 bucket as a filesystem
Using this setup, you can upload, download, mount, and manage files in a CMP S3 bucket from a Linux server.
Prerequisites
Before starting, make sure you have the following:
- A Linux VM, for example Ubuntu
- CMP S3 Access Key
- CMP S3 Secret Key
- Target bucket name: linux-backup-test
- Basic knowledge of Linux command-line operations
- Internet connectivity from the Linux VM to the CMP S3 endpoint
Understanding CMP S3 Access Control
CMP S3 supports two access modes:
Bucket visibility
- Public bucket
- Private bucket
Access using keys
- Access Key
- Secret Key
The Access Key and Secret Key generated from CMP S3 provide access to CMP S3 resources.
Note: Keys created in CMP S3 work only within CMP S3.
How to Create Access Key and Secret Key in CMP
To access CMP S3 buckets securely, you need to generate an Access Key and Secret Key.
Steps:
- Log in to the CMP Dashboard.
- Navigate to Object Storage.
- Click on the Access tab.
- You will see fields like:
Region
User ID
Accounts
Status
- Click on the required access section.
- Click on Create First Key or Create Key if one already exists.
- Copy the generated:
Access Key
Secret Key
Important: Save the Secret Key securely, as it is shown only once.
Installing s3cmd on Linux VM
Run the following commands:
sudo apt update
sudo apt install s3cmd -yVerify the installation:
s3cmd –versionConfiguring s3cmd for CMP S3
Run the configuration wizard:
s3cmd –configureEnter the following details when prompted:
Prompt : Value
Access Key : <Your-Access-Key>
Secret Key : <Your-Secret-Key>
Default Region : in-west2
S3 Endpoint : s3.in-west2.purestore.io
DNS-style bucket+hostname:port template : %(bucket)s.s3.in-west2.purestore.io
Encryption password : Optional or leave blank
Path to GPG program : /usr/bin/gpg
Use HTTPS protocol : True
HTTP Proxy server name : Leave blank unless required
HTTP Proxy server port : 0
Note: Do not add https:// in the S3 Endpoint field during s3cmd –configure.Validate s3cmd Configuration
Run the following command to check bucket access:
s3cmd lsExpected output should show the available bucket, for example:
s3://linux-backup-testCommon Operations Using s3cmd
- List Buckets
s3cmd ls- List Objects in Bucket
s3cmd ls s3://linux-backup-test- Create a Test File
Before uploading, create a test file on the server:
echo “This is a test file for CMP S3 upload” > today1234.txtVerify the file:
ls -lh today1234.txt
cat today1234.txt- Upload a File
Upload the test file to the CMP S3 bucket:
s3cmd put today1234.txt s3://linux-backup-testVerify the uploaded file:
s3cmd ls s3://linux-backup-test- Download a File
Download the file from the bucket:
s3cmd get s3://linux-backup-test/today1234.txtTo download the file to a specific directory:
mkdir -p /mnt/cmp-s3
s3cmd get s3://linux-backup-test/today1234.txt /mnt/cmp-s3/today1234.txtVerify the downloaded file:
ls -lh /mnt/cmp-s3/today1234.txt
cat /mnt/cmp-s3/today1234.txtMount CMP S3 as a Filesystem Using s3fs
s3fs allows you to mount the CMP S3 bucket as a local directory on the Linux server.
- Install s3fs
sudo apt update
sudo apt install s3fs -y- Create Credentials File
Create the password file using the Access Key and Secret Key:
echo ACCESS_KEY:SECRET_KEY > ~/.passwd-s3fsExample:
echo ABCD123456789:xyzsecretkey123456789 > ~/.passwd-s3fsSet secure permission:
chmod 600 ~/.passwd-s3fsImportant: Replace ACCESS_KEY and SECRET_KEY with the actual CMP S3 credentials.- Create Mount Directory
Create the directory where the bucket will be mounted:
mkdir -p /mnt/cmp-s3Verify the directory:
ls -ld /mnt/cmp-s3- Mount the CMP S3 Bucket
Mount the bucket linux-backup-test on /mnt/cmp-s3:
s3fs linux-backup-test /mnt/cmp-s3 -o url=https://s3.in-west2.purestore.io -o use_path_request_style- Verify the Mount
Check whether the bucket is mounted successfully:
mount | grep s3fsExpected output:
s3fs on /mnt/cmp-s3 type fuse.s3fsYou can also check using:
df -h | grep cmp-s3List files from the mounted bucket:
ls -la /mnt/cmp-s3File Operations Using Mounted S3 Directory
Once the bucket is mounted, you can manage files like a normal Linux directory.
- Create a Local Test File
Create a local test file:
echo “This is a test upload using s3fs mount” > /root/localfile.txtVerify it:
ls -lh /root/localfile.txt
cat /root/localfile.txt- Upload File to Bucket Using cp Command
Copy the local file to the mounted S3 bucket:
cp /root/localfile.txt /mnt/cmp-s3/Verify:
ls -lh /mnt/cmp-s3/You can also verify using s3cmd:
s3cmd ls s3://linux-backup-test- Create a New File Directly in Mounted Bucket
Create a file directly inside the mounted S3 bucket:
echo “Hello CMP S3” > /mnt/cmp-s3/hello.txtVerify:
ls -lh /mnt/cmp-s3/hello.txt
cat /mnt/cmp-s3/hello.txt- Download/Copy File from Mounted Bucket to Local Server
Create a local download directory:
mkdir -p ~/DownloadsCopy the file from mounted bucket to local directory:
cp /mnt/cmp-s3/hello.txt ~/Downloads/Verify:
ls -lh ~/Downloads/hello.txt
cat ~/Downloads/hello.txt- Delete a File from Bucket
Delete the file from the mounted S3 bucket:
rm /mnt/cmp-s3/hello.txtVerify:
rm /mnt/cmp-s3/hello.txtOr verify using:
s3cmd ls s3://linux-backup-testUnmount the Bucket
When the work is completed, unmount the bucket:
fusermount -u /mnt/cmp-s3If fusermount is not available, use:
umount /mnt/cmp-s3Verify that it is unmounted:
mount | grep s3fsIf no output is shown, the bucket has been unmounted successfully.
Important Notes
- Make sure the mount directory exists before running the s3fs mount command.
- Keep the .passwd-s3fs file secure with 600 permission.
- Do not share the Secret Key with anyone.
- Use HTTPS endpoint for secure connectivity.
- For persistent mount after reboot, an entry can be added in /etc/fstab with proper credential handling.
- If s3cmd ls gives a connection refused error, check that use_https = True is configured in ~/.s3cfg.
Troubleshooting
Issue: Connection Refused
Error:
ERROR: Could not connect to server: [Errno 111] Connection refusedCheck the ~/.s3cfg file:
cat ~/.s3cfgMake sure this value is set:
use_https = TrueAlso confirm the endpoint:
host_base = s3.in-west2.purestore.io
host_bucket = %(bucket)s.s3.in-west2.purestore.ioIssue: File Not Found During Copy
Error:
cp: cannot stat ‘/path/to/localfile.txt’: No such file or directoryReason:
/path/to/localfile.txt is only a sample path. You need to create an actual file first.
Create a test file:
echo “This is a test file” > /root/localfile.txtThen copy it:
cp /root/localfile.txt /mnt/cmp-s3/Issue: Mount Directory Does Not Exist
Create the mount directory:
mkdir -p /mnt/cmp-s3Then run the mount command again.
Conclusion
CMP S3 bucket storage can be accessed from Linux using both s3cmd and s3fs.
- s3cmd is useful for CLI-based upload/download operations.
- s3fs is useful when you want to mount the S3 bucket as a local filesystem.
In this setup, the bucket linux-backup-test was configured and mounted successfully on:
/mnt/cmp-s3