dataherb.utils.awscli
utils.awscli¤
aws_cli(cmd)
¤
aws_cli invokes the aws cli processes in python to execute awscli commands.
Warning
This is not the most elegant way of using awscli.
However, it has been a convinient function in data science projects.
Examples
AWS credential env variables should be configured before calling this function. The awscli command should be wrapped as a tuple. To download data from S3 to a local path, use
>>> aws_cli(('s3', 'sync', 's3://s2-fpd/augmentation/', '/tmp/test'))
Similarly, upload is done in the following way
>>> # local_path = ''
>>> # remote_path = ''
>>> _aws_cli(('s3', 'sync', local_path, remote_path))
References
This function is adapted from https://github.com/boto/boto3/issues/358#issuecomment-372086466
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*cmd |
tuple
|
tuple of awscli command. |
()
|
Source code in dataherb/utils/awscli.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|