Read more

How to: Use different configurations for S3cmd

Emanuel
September 18, 2018Software engineer at makandra GmbH

S3cmd is a free command line tool and client for uploading, retrieving and managing data in Amazon S3. S3cmd reads its configuration by default from ~/.s3cfg, which is created once you run s3cmd --configure.

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

If you have many configurations, we recommend to always specify the configuration you want to use. This prevents applying actions to the wrong bucket.

Examples:

s3cmd -c ~/.s3cfg-github-staging ls
s3cmd -c ~/.s3cfg-github-development ls
s3cmd -c ~/.s3cfg-facebook-production ls

Keep in mind to move every new configuration from ~/.s3cfg to ~/.s3cfg-$project-$env.

Another approach is changing your configuration via symlink. This has the advantage that you do not have to provide the config file for each command, but you have to be sure, that the correct config file is currently linked.

Example:

ls ~/.s3cfg*
~/.s3cfg-github-staging ~/.s3cfg-github-development ~/.s3cfg-facebook-production

ln -s ~/.s3cfg-github-staging ~/.s3cfg
Posted by Emanuel to makandra dev (2018-09-18 14:33)