Questions tagged [boto]

boto is an open-source Python Interface to Amazon Web Services

Boto is a Python package that provides an interface to Amazon Web Services. The code is hosted on github.com (https://github.com/boto/boto) and the documentation can be found at http://docs.pythonboto.org.

Boto supports the following services:

  • Compute
    • Amazon Elastic Compute Cloud (EC2)
    • Amazon Elastic Map Reduce (EMR)
    • AutoScaling
    • Elastic Load Balancing (ELB)
  • Content Delivery
    • Amazon CloudFront
  • Database
    • Amazon Relational Data Service (RDS)
    • Amazon DynamoDB
    • Amazon SimpleDB
  • Deployment and Management
    • AWS Identity and Access Management (IAM)
    • Amazon CloudWatch
    • AWS Elastic Beanstalk
    • AWS CloudFormation
  • Application Services
    • Amazon CloudSearch
    • Amazon Simple Workflow Service (SWF)
    • Amazon Simple Queue Service (SQS)
    • Amazon Simple Notification Server (SNS)
    • Amazon Simple Email Service (SES)
  • Networking
    • Amazon Route53
    • Amazon Virtual Private Cloud (VPC)
  • Payments and Billing
    • Amazon Flexible Payment Service (FPS)
  • Storage
    • Amazon Simple Storage Service (S3)
    • Amazon Glacier
    • Amazon Elastic Block Store (EBS)
    • Google Cloud Storage
  • Workforce
    • Amazon Mechanical Turk
  • Other
    • Marketplace Web Services
2362 questions
80
votes
5 answers

How to upload a file to Google Cloud Storage on Python 3?

How can I upload a file to Google Cloud Storage from Python 3? Eventually Python 2, if it's infeasible from Python 3. I've looked and looked, but haven't found a solution that actually works. I tried boto, but when I try to generate the necessary…
aknuds1
  • 65,625
  • 67
  • 195
  • 317
79
votes
8 answers

Python boto, list contents of specific dir in bucket

I have S3 access only to a specific directory in an S3 bucket. For example, with the s3cmd command if I try to list the whole bucket: $ s3cmd ls s3://bucket-name I get an error: Access to bucket 'my-bucket-url' was denied But if I try access a…
Martin Taleski
  • 6,033
  • 10
  • 40
  • 78
74
votes
7 answers

Can you upload to S3 using a stream rather than a local file?

I need to create a CSV and upload it to an S3 bucket. Since I'm creating the file on the fly, it would be better if I could write it directly to S3 bucket as it is being created rather than writing the whole file locally, and then uploading the file…
inquiring minds
  • 1,785
  • 2
  • 15
  • 16
74
votes
4 answers

Amazon S3 boto: How do you rename a file in a bucket?

How do you rename a S3 key in a bucket with boto?
felix
  • 741
  • 1
  • 5
  • 3
71
votes
6 answers

How do I get the file / key size in boto S3?

There must be an easy way to get the file size (key size) without pulling over a whole file. I can see it in the Properties of the AWS S3 browser. And I think I can get it off the "Content-length" header of a "HEAD" request. But I'm not…
mjhm
  • 16,497
  • 10
  • 44
  • 55
67
votes
4 answers

How to peek at messages in the queue

I don't want the message to count as "read" but I'd like to know what's in the queue. The documentation: http://boto.s3.amazonaws.com/ref/sqs.html#module-boto.sqs Isn't very straight forward about what absorbs a message and what doesn't. The dump…
Ralphleon
  • 3,968
  • 5
  • 32
  • 34
65
votes
4 answers

How to get the region of the current user from boto?

Problem: I'm trying to get the region of the authenticated user from boto3. Use case: I'm working on adding cache to https://github.com/pmazurek/aws-fuzzy-finder. I would prefer to cache the result on per-region basis. This package uses boto to get…
Piotr Mazurek
  • 1,083
  • 1
  • 8
  • 14
65
votes
10 answers

DynamoDB : The provided key element does not match the schema

Is there a way to get an item depending on a field that is not the hashkey? Example My Table Users: id (HashKey), name, email And I want to retrieve the user having email as 'test@mail.com' How this can be done? I try this with boto: user =…
user1635536
61
votes
3 answers

How do you create an EC2 instance with multiple key pairs?

While creating an EC2 instance, we provide a key pair name. But generally, I associate multiple SSH public/private keys with any remote server. I know that it's not possible to attach a key pair once the EC2 server has been created, but I would like…
Pattu
  • 3,481
  • 8
  • 32
  • 41
59
votes
10 answers

Upload image available at public URL to S3 using boto

I'm working in a Python web environment and I can simply upload a file from the filesystem to S3 using boto's key.set_contents_from_filename(path/to/file). However, I'd like to upload an image that is already on the web (say…
dgh
  • 8,969
  • 9
  • 38
  • 49
57
votes
13 answers

upload a directory to s3 with boto

I am already connected to the instance and I want to upload the files that are generated from my python script directly to S3. I have tried this: import boto s3 = boto.connect_s3() bucket = s3.get_bucket('alexandrabucket') from boto.s3.key import…
56
votes
11 answers

AWS: Boto3: AssumeRole example which includes role usage

I'm trying to use the AssumeRole in such a way that i'm traversing multiple accounts and retrieving assets for those accounts. I've made it to this point: import boto3 stsclient = boto3.client('sts') assumedRoleObject =…
mumbles
  • 989
  • 2
  • 8
  • 19
56
votes
3 answers

Using boto to invoke lambda functions how do I do so asynchronously?

SO I'm using boto to invoke my lambda functions and test my backend. I want to invoke them asynchronously. I have noted that "invoke_async" is deprecated and should not be used. Instead you should use "invoke" with an InvocationType of "Event" to…
sometimesiwritecode
  • 2,993
  • 7
  • 31
  • 69
56
votes
13 answers

Move files between two AWS S3 buckets using boto3

I have to move files between one bucket to another with Python Boto API. (I need it to "Cut" the file from the first Bucket and "Paste" it in the second one). What is the best way to do that? ** Note: Is that matter if I have two different ACCESS…
Gal
  • 669
  • 2
  • 8
  • 9
55
votes
9 answers

boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden

I'm trying to get django to upload static files to S3, but istead I'm getting a 403 forbidden error, and I'm not sure why. Full Stacktrace: Traceback (most recent call last): File "manage.py", line 14, in execute_manager(settings) …
Levi Campbell
  • 6,005
  • 7
  • 40
  • 47