boto

How can we fetch IAM users, their groups and policies?

≯℡__Kan透↙ 提交于 2019-12-31 22:49:08
问题 I need to fetch all the aws user's, their corresponding groups, policies and then if mfa is activated for them or not. Can anyone tell me how it can be done via aws cli or boto. I have a script that fetches out just the all user's in aws. import boto3 from boto3 import * import argparse access_key = '' secret_key = '' def get_iam_uses_list(): client = boto3.client('iam', aws_access_key_id=access_key, aws_secret_access_key=secret_key) my_list=list() iam_all_users = client.list_users(MaxItems

Fastest way to download 3 million objects from a S3 bucket

痴心易碎 提交于 2019-12-31 08:13:42
问题 I've tried using Python + boto + multiprocessing, S3cmd and J3tset but struggling with all of them. Any suggestions, perhaps a ready-made script you've been using or another way I don't know of? EDIT: eventlet+boto is a worthwhile solution as mentioned below. Found a good eventlet reference article here http://web.archive.org/web/20110520140439/http://teddziuba.com/2010/02/eventlet-asynchronous-io-for-g.html I've added the python script that I'm using right now below. 回答1: Okay, I figured out

Fastest way to download 3 million objects from a S3 bucket

霸气de小男生 提交于 2019-12-31 08:13:41
问题 I've tried using Python + boto + multiprocessing, S3cmd and J3tset but struggling with all of them. Any suggestions, perhaps a ready-made script you've been using or another way I don't know of? EDIT: eventlet+boto is a worthwhile solution as mentioned below. Found a good eventlet reference article here http://web.archive.org/web/20110520140439/http://teddziuba.com/2010/02/eventlet-asynchronous-io-for-g.html I've added the python script that I'm using right now below. 回答1: Okay, I figured out

s3 - how to get fast line count of file? wc -l is too slow

我是研究僧i 提交于 2019-12-31 03:35:11
问题 Does anyone have a quick way of getting the line count of a file hosted in S3? Preferably using the CLI, s3api but I am open to python/boto as well. Note: solution must run non-interactively, ie in an overnight batch. Right no i am doing this, it works but takes around 10 minutes for a 20GB file: aws cp s3://foo/bar - | wc -l 回答1: Here's two methods that might work for you... Amazon S3 has a new feature called S3 Select that allows you to query files stored on S3. You can perform a count of

s3- boto- list files within a bucket by upload time

浪尽此生 提交于 2019-12-30 22:59:10
问题 I need to download every hour 100 newest files from s3 server. bucketList = bucket.list(PREFIX) The code above creates list of the files but it is not depend on the uploading time of the files, since it lists by file name? I can do nothing with file name. It is given randomly. Thanks. 回答1: How big is the list? You could sort the list on the 'last_modified' attr of the Key orderedList = sorted(bucketList, key=lambda k: k.last_modified) keysYouWant = orderedList[0:100] If your list is HUGE this

Pagination in Amazon DynamoDB using Boto

北城余情 提交于 2019-12-30 18:05:11
问题 How do I paginate my results from DynamoDB using the Boto python library? From the Boto API documentation, I can't figure out if it even has support for pagination, although the DynamoDB API does have pagination support. 回答1: Boto does have support for "pagination" like behavior using a combination of "ExclusiveStartKey" and "Limit". For example, to paginate Scan . Here is an example that should parse a whole table by chunks of 10 esk = None while True: # load this batch scan_generator =

Pagination in Amazon DynamoDB using Boto

风格不统一 提交于 2019-12-30 18:04:07
问题 How do I paginate my results from DynamoDB using the Boto python library? From the Boto API documentation, I can't figure out if it even has support for pagination, although the DynamoDB API does have pagination support. 回答1: Boto does have support for "pagination" like behavior using a combination of "ExclusiveStartKey" and "Limit". For example, to paginate Scan . Here is an example that should parse a whole table by chunks of 10 esk = None while True: # load this batch scan_generator =

How do I get the S3 key's created date with boto?

早过忘川 提交于 2019-12-30 05:20:05
问题 Boto's S3 Key object contains last_modified date (which is nicely available via parse_ts, thanks @Gaarnat!) but the base_field "date" (i.e., ctime) doesn't seem to be accessible, even though it's listed in key.base_fields. Based on the table at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html, it does seem that it is always automatically created (and I can't imagine a reason why it wouldn't be). It's probably just a simple matter of finding it somewhere in the object

boto dynamodb2: Can I query a table using range key only?

蓝咒 提交于 2019-12-30 04:41:44
问题 In one of my python application, I am using boto and I want to query a dynamodb table using range key only. I don't want to use scan. Schema for ratings table ratings = Table.create('ratings', schema=[ HashKey('user_id', data_type=NUMBER), RangeKey('photo_id', data_type=NUMBER) ], throughput={ 'read': 5, 'write': 15, }, indexes = [ AllIndex('rating_allindex', parts=[ HashKey('user_id', data_type=NUMBER), RangeKey('photo_id', data_type=NUMBER) ]) ]) from boto.dynamodb2.table import Table

S3 using boto and SigV4 - missing host parameter

☆樱花仙子☆ 提交于 2019-12-30 04:37:30
问题 when developing i used a S3 bucket in ireland, which worked well. For production i want to use the new "Frankfurt" location of S3, but apparently the new Frankfurt region uses the "SigV4" which breaks my python script. When adding the following block to ~/.boto, i get the following error: ~/.boto: [s3] use-sigv4 = True Error: File "/usr/lib/python2.6/site-packages/boto/__init__.py", line 141, in connect_s3 return S3Connection(aws_access_key_id, aws_secret_access_key, **kwargs) File "/usr/lib