boto

Download S3 Files with Boto

岁酱吖の 提交于 2021-02-18 11:42:05
问题 I am trying to set up an app where users can download their files stored in an S3 Bucket. I am able to set up my bucket, and get the correct file, but it won't download, giving me the this error: No such file or directory: 'media/user_1/imageName.jpg' Any idea why? This seems like a relatively easy problem, but I can't quite seem to get it. I can delete an image properly, so it is able to identify the correct image. Here's my views.py def download(request, project_id=None): conn =

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

我只是一个虾纸丫 提交于 2021-02-17 14:32:32
问题 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 to do this in 1 request. What I did is like this: item = self.list_table.get_item(**{'k': 'some_key'}) item['v'].append('some_value') item.partial_save() I request the server first and save it after modified the value. That's not atomic and looks ugly. Is there any way to do this in one

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

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-17 14:31:41
问题 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 to do this in 1 request. What I did is like this: item = self.list_table.get_item(**{'k': 'some_key'}) item['v'].append('some_value') item.partial_save() I request the server first and save it after modified the value. That's not atomic and looks ugly. Is there any way to do this in one

How to set metadata in S3 using boto?

谁说胖子不能爱 提交于 2021-02-10 12:17:48
问题 I am trying to set metadata during pushing a file to S3. This is how it looks like : def pushFileToBucket(fileName, bucket, key_name, metadata): full_key_name = os.path.join(fileName, key_name) k = bucket.new_key(full_key_name) k.set_metadata('my_key', 'value') k.set_contents_from_filename(fileName) For some reason this throws error at set_metadata saying : boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden <?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch<

utf-8 filename in s3 bucket

拥有回忆 提交于 2021-02-09 11:13:14
问题 Is it possible to add a key to s3 with an utf-8 encoded name like "åøæ.jpg"? I'm getting the following error when uploading with boto: <Error><Code>InvalidURI</Code><Message>Couldn't parse the specified URI.</Message> 回答1: @2083: This is a bit of an old question, but if you haven't found the solution, and for everyone else that comes here like me looking for an answer: From the official documentation (http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html): Although you can use any

utf-8 filename in s3 bucket

你。 提交于 2021-02-09 11:12:52
问题 Is it possible to add a key to s3 with an utf-8 encoded name like "åøæ.jpg"? I'm getting the following error when uploading with boto: <Error><Code>InvalidURI</Code><Message>Couldn't parse the specified URI.</Message> 回答1: @2083: This is a bit of an old question, but if you haven't found the solution, and for everyone else that comes here like me looking for an answer: From the official documentation (http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html): Although you can use any

utf-8 filename in s3 bucket

旧街凉风 提交于 2021-02-09 11:12:24
问题 Is it possible to add a key to s3 with an utf-8 encoded name like "åøæ.jpg"? I'm getting the following error when uploading with boto: <Error><Code>InvalidURI</Code><Message>Couldn't parse the specified URI.</Message> 回答1: @2083: This is a bit of an old question, but if you haven't found the solution, and for everyone else that comes here like me looking for an answer: From the official documentation (http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html): Although you can use any

utf-8 filename in s3 bucket

跟風遠走 提交于 2021-02-09 11:12:00
问题 Is it possible to add a key to s3 with an utf-8 encoded name like "åøæ.jpg"? I'm getting the following error when uploading with boto: <Error><Code>InvalidURI</Code><Message>Couldn't parse the specified URI.</Message> 回答1: @2083: This is a bit of an old question, but if you haven't found the solution, and for everyone else that comes here like me looking for an answer: From the official documentation (http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html): Although you can use any

How to get the price of a running EC2 spot instance?

被刻印的时光 ゝ 提交于 2021-02-07 06:51:17
问题 I am trying to create ec2 spot instances using boto3 api, so far I am able to get the spot instance history price, spin up a spot instance, etc. But I don't know how to get the price we are paying for spot instance using boto api. anyone know how to do this ? Thanks 回答1: Update: See: Spot Instance Interruptions - Amazon Elastic Compute Cloud Old answer: When launching a spot instance under Amazon EC2, you specify a maximum hourly price, known as a bid . This is the maximum price that will be

Consuming a kinesis stream in python

╄→尐↘猪︶ㄣ 提交于 2021-02-05 13:40:10
问题 I cant seem to find a decent example that shows how can I consume an AWS Kinesis stream via Python. Can someone please provide me with some examples I could look into? Best 回答1: While this question has already been answered, it might be a good idea for future readers to consider using the Kinesis Client Library (KCL) for Python instead of using boto directly. It simplifies consuming from the stream when you have multiple consumer instances, and/or changing shard configurations . https://aws