Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional AWS profile authentication #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions s4cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,10 @@ def connect(self):
S3Handler.S3_KEYS[1],
is_secure = self.opt.use_ssl,
suppress_consec_slashes = False)
elif self.opt.profile:
self.s3 = boto.connect_s3(is_secure = self.opt.use_ssl,
suppress_consec_slashes = False,
profile_name = self.opt.profile)
else:
self.s3 = boto.connect_s3(is_secure = self.opt.use_ssl,
suppress_consec_slashes = False)
Expand Down Expand Up @@ -1382,6 +1386,9 @@ def _totalsize_handler(self, args):
parser.add_option(
'-d', '--show-directory', help = 'show directory instead of its content',
dest = 'show_dir', action = 'store_true', default = False)
parser.add_option(
'-P', '--profile', help = 'Optional AWS profile to authenticate with',
dest = 'profile', type = 'string', default = False)
parser.add_option(
'--ignore-empty-source', help = 'ignore empty source from s3',
dest = 'ignore_empty_source', action = 'store_true', default = False)
Expand Down Expand Up @@ -1474,3 +1481,4 @@ def _totalsize_handler(self, args):
# Fix setup.py for module and command line tool
# - 1.5.21: Merge changes from linsomniac@github for better argument parsing
# - 1.5.22: Add compatibility for Python3
# - 1.5.23: Add optional AWS profile authentication