Managing AWS S3 Storage with CLI and Session Persistence

Using S3-Compatible GUI Tools

To interact with Amazon S3 buckets through a graphical interface, tools like S3 Browser (or modern alternatives such as Rclone Browser or Cyberduck) can be configured as follows: 1. Launch the application and select "Add Account" or "New Connection". 2. Enter your IAM credentials: Access Key ID and Secret Access Key. 3. Specify the target region (e.g., us-east-1) and optionally enable SSL/TLS. 4. Either create a new bucket directly from the UI or connect to an existing one by entering its name. 5. Once connected, browse, upload, download, or delete objects using drag-and-drop or context menus.

Transferring Files from Linux Servers to S3

To automate uploads from a remote server, configure the official AWS CLI: 1. Install aws-cli v2 (recommended for improved performance and security):
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install 2. Verify installation:
aws --version 3. Configure authentication and defaults:
aws configure

 Provide: 
- AWS Access Key ID
- AWS Secret Access Key
- Default region (e.g., `ap-southeast-1`)
- Output format (e.g., `text` or `json`)
  1. Perform bidirectional synchronization:
    To mirror a local directory to S3:

    aws s3 sync /var/www/html s3://my-static-site-bucket/ --delete
    

    This ensures S3 reflects the exact state of the local path, removing obsolete objects.

Advanced Sync Options

  • List contents of a bucket prefix:
    aws s3 ls s3://my-static-site-bucket/assets/ --human-readable
    
  • Upload only changed files based on size and last-modified timestamp:
    aws s3 sync /data/reports s3://backup-repo/monthly/ --size-only --exact-timestamps
    
  • Suppress non-error output during large transfers:
    aws s3 sync /tmp/logs s3://log-archive/ --only-show-errors --quiet
    

Maintaining Long-Running Transfers Across Terminal Disconnections

For multi-hour sync operations—especially with large datasets—use terminal multiplexers to prevent interruption: 1. Install screen:
sudo apt update && sudo apt install screen -y 2. Start a named session:
screen -S s3-upload-session

 All subsequent commands run inside this persistent environment.
  1. Detach safely without stopping processes: press Ctrl+A, then D.
  2. Reattach later:
    screen -r s3-upload-session
    
  3. List active sessions:
    screen -ls
    

Note: For production environments, consider using tmux as a more feature-rich alternative, or orchestrate transfers via systemd services or cloud-native solutions like AWS DataSync for enterprise-grade reliability.

Tags: aws-cli s3 screen Linux cloud-storage

Posted on Mon, 28 Sep 2026 16:19:05 +0000 by meral