Registry / aws / s3cmd
library2.4.0pypypi✓ verified 24d ago

s3cmd is a free, feature-rich, command-line tool for managing Amazon S3 and other S3-compatible cloud storage services. Written in Python, it allows users to upload, retrieve, and manage data with simple shell commands. The current version is 2.4.0, and it follows an active maintenance release cadence.

pip install s3cmd
INSTALL
IMPORT
SIG · S3CMD
S
s3cmd
awspythonv2.4.0
Install
1.8s avg
Import
317ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.4.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.334s · 19.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.8s · import 0.300s · 20MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

S3
from S3 import S3
import subprocess

Demonstrates how to interact with the s3cmd command-line tool from a Python script using the `subprocess` module to list S3 buckets. Users must ensure s3cmd is installed and configured with appropriate AWS credentials (e.g., via `s3cmd --configure` or environment variables).

import subprocess # s3cmd requires prior configuration (e.g., via `s3cmd --configure` or AWS environment variables/IAM roles). # This example assumes s3cmd is configured to access an S3 bucket. # Example: List S3 buckets try: # Using check=True will raise CalledProcessError if s3cmd exits with a non-zero status result = subprocess.run(['s3cmd', 'ls'], check=True, capture_output=True, text=True) print("S3 Buckets:\n", result.stdout) except subprocess.CalledProcessError as e: print(f"Error listing buckets: {e.stderr}") print("Ensure s3cmd is correctly configured (e.g., with valid credentials in ~/.s3cfg).") except FileNotFoundError: print("s3cmd command not found. Ensure it's installed and in your system's PATH.")
s3cmd --version
Debug
Known issues
breakingSince version 2.0.0, AWS Signature Version 4 (SigV4) is the default and preferred signing method. If you have an existing `.s3cfg` configuration that explicitly forces AWS Signature Version 2 (`signature_v2 = True`), operations might fail or behave unexpectedly with newer AWS regions.
fix
Review your `~/.s3cfg` file and remove or set `signature_v2 = False`. Ensure your AWS region supports SigV4 (most modern regions do). Re-run `s3cmd --configure` to generate a new, compliant configuration if needed.
affects: >=2.0.0
gotchas3cmd relies heavily on its configuration file, typically located at `~/.s3cfg`. Incorrect or missing configurations (e.g., access keys, secret keys, default region) will lead to authentication failures or unexpected behavior.
fix
Run `s3cmd --configure` to create or update your `~/.s3cfg` file, providing your AWS Access Key, Secret Key, and optionally a default region. Ensure the file has appropriate permissions (e.g., `chmod 600 ~/.s3cfg`).
affects: all
gotchaStarting with version 2.0.0, Server-Side Encryption (SSE-S3) is enabled by default for new object uploads. If you require unencrypted objects or a different encryption method, you must explicitly specify it.
fix
To upload objects without SSE-S3 encryption, use the `--no-encryption` option. For other encryption types (e.g., SSE-C, SSE-KMS), refer to the s3cmd documentation for specific options like `--sse` or `--encrypt`.
affects: >=2.0.0
gotchaWhen deleting objects or buckets, s3cmd often requires the `--force` option. Using `--force` can lead to irreversible data loss if used incorrectly, especially with recursive deletes or bucket removals.
fix
Always double-check your `s3cmd del` or `s3cmd rm` commands before adding `--force`. Consider using the `--dry-run` option first to preview the operations that would be performed without actually executing them.
affects: all
gotchaConnecting to non-AWS S3-compatible storage services (e.g., MinIO, DigitalOcean Spaces) requires specifying custom host and bucket host parameters, as defaults are for AWS S3.
fix
Use the `--host` and `--host-bucket` options to point to the specific endpoint of your S3-compatible service. For example, `--host=sgp1.digitaloceanspaces.com --host-bucket=%(bucket)s.sgp1.digitaloceanspaces.com` for DigitalOcean Spaces.
affects: all
Upgrade
Version history
2.4.0latest on PyPI · released Dec 12, 2023
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
22
Resources