boto

Creating a S3 bucket in Amazon AWS with boto in python fails …

Creating a S3 bucket in Amazon AWS with boto in python fails … Question: import boto import boto.s3 import boto.s3.connection conn = boto.s3.connect_to_region( ‘us-west-2′, aws_access_key_id=’MY_KEY’, aws_secret_access_key=’MY_ACCESS_KEY’ ) conn.create_bucket(‘bucket_in_west’) And I get this error: Traceback (most recent call last): File “<input>”, line 1, in <module> File “/Users/user/.virtualenvs/west-tests/lib/python2.7/site-packages/boto/s3/connection.py”, line 621, in create_bucket response.status, response.reason, body) S3ResponseError: S3ResponseError: …

Total answers: 1

What is the difference between the AWS boto and boto3

What is the difference between the AWS boto and boto3 Question: I’m trying to learn the boto API and I noticed that there are two major versions/packages for Python: boto and boto3. What is the difference between the AWS boto and boto3 libraries? Asked By: Matt || Source Answers: The boto package is the hand-coded …

Total answers: 2

Boto allocate elastic IP

Boto allocate elastic IP Question: I can’t find how to allocate an elastic IP using Boto. I found how to assign it to an instance but not the allocation of the IP itself. Can you show me how to do it? Thank you Asked By: user1618465 || Source Answers: In boto you would use: import …

Total answers: 1

PyCharm intellisense for boto3

PyCharm intellisense for boto3 Question: having problems seeing full intellisense (code completion) options in PyCharm. working with python 3.4 on Windows. the suggests are partially working: import boto3 s = boto3.Session() (boto3. will bring up list of methods/params of object boto3) ec2 = s.resource(‘ec2’) (resource is a suggested method!) ec2. <<<< this brings up nothing. …

Total answers: 10

How to get the row count of a table instantly in DynamoDB?

How to get the row count of a table instantly in DynamoDB? Question: I’m using boto.dynamodb2, and it seems I can use Table.query_count(). However it had raised an exception when no query filter is applied. What can I do to fix this? BTW, where is the document of filters that boto.dynamodb2.table.Table.Query can use? I tried …

Total answers: 4

How to append a value to list attribute on AWS DynamoDB?

How to append a value to list attribute on AWS DynamoDB? Question: I’m using DynamoDB as an K-V db (cause there’s not much data, I think that’s fine) , and part of ‘V’ is list type (about 10 elements). There’s some session to append a new value to it, and I cannot find a way …

Total answers: 4

Listing contents of a bucket with boto3

Listing contents of a bucket with boto3 Question: How can I see what’s inside a bucket in S3 with boto3? (i.e. do an “ls”)? Doing the following: import boto3 s3 = boto3.resource(‘s3’) my_bucket = s3.Bucket(‘some/path/’) returns: s3.Bucket(name=’some/path/’) How do I see its contents? Asked By: Amelio Vazquez-Reina || Source Answers: One way to see the …

Total answers: 21

Is it possible to check if a bucket name already exists?

Is it possible to check if a bucket name already exists? Question: I have a method that needs a name to create a new bucket. And I want to show a message “bucket name already exist” if the bucket name already exist. It is possible to check if a bucket name already exists? def createBucket(bucketName): …

Total answers: 4

How to save S3 object to a file using boto3

How to save S3 object to a file using boto3 Question: I’m trying to do a “hello world” with new boto3 client for AWS. The use-case I have is fairly simple: get object from S3 and save it to the file. In boto 2.X I would do it like this: import boto key = boto.connect_s3().get_bucket(‘foo’).get_key(‘foo’) …

Total answers: 7

Get ec2 instance metadata from instance id

Get ec2 instance metadata from instance id Question: Hi I am using boto to spin up ec2 spot instance. I am having trouble getting instance hostname from instance id. there is easies way to do from instance itself “wget -q -O – http://169.254.169.254/latest/meta-data/instance-id“ but I am looking for way to get metadata using instance id …

Total answers: 2