boto3

Sync two buckets through boto3

家住魔仙堡 提交于 2020-01-23 03:27:06
问题 Is there any way to use boto3 to loop the bucket contents in two different buckets (source and target) and if it finds any key in source that does not match with target, it uploads it to the target bucket. please note I do not want to use aws s3 sync. I am currently using the following code for doing this job: import boto3 s3 = boto3.resource('s3') src = s3.Bucket('sourcenabcap') dst = s3.Bucket('destinationnabcap') objs = list(dst.objects.all()) for k in src.objects.all(): if (k.key !=objs[0

return item with maximum sort-key in dynamodb

拜拜、爱过 提交于 2020-01-22 23:06:11
问题 I'm using a python script to access a dynamodb database in AWS. I have a table with a hash key and sort key. For a given hash key, I want to find the item with the largest sort key that is less than a certain value. How can I do that? Alternatively, is there a way to find the previous item from a given key? I am not trying to find the item with the largest attribute value (an expensive task in dynamodb), I want the largest key value. 回答1: I found the answer, import boto3 import botocore from

botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint

我怕爱的太早我们不能终老 提交于 2020-01-17 05:20:12
问题 I'm running Ubuntu 12.04, Python 2.7.3 and trying to run chalice However, when I run chalice deploy I get back: botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/helloworld" I can't find any information on what's causing this. My AWS configuration was setup and tested to be working with boto. My config: [default] output = table region = us-west-1 回答1: As per your config you have setup the region to

How to delete still available HITs using boto3 client

£可爱£侵袭症+ 提交于 2020-01-16 17:32:18
问题 I have some published HITs available to workers. Now I want to delete them although they haven't been finished by the workers. According to this documentation, it is not possible: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/mturk.html#MTurk.Client.delete_hit Only HITs in reviewable state can be deleted. But using the command line interface it seems to be possible: https://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkCLT/CLTReference_DeleteHITsCommand.html My

How to delete still available HITs using boto3 client

僤鯓⒐⒋嵵緔 提交于 2020-01-16 17:30:28
问题 I have some published HITs available to workers. Now I want to delete them although they haven't been finished by the workers. According to this documentation, it is not possible: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/mturk.html#MTurk.Client.delete_hit Only HITs in reviewable state can be deleted. But using the command line interface it seems to be possible: https://docs.aws.amazon.com/AWSMechTurk/latest/AWSMturkCLT/CLTReference_DeleteHITsCommand.html My

How to configure AWS4 S3 Authorization in Django?

和自甴很熟 提交于 2020-01-16 13:12:06
问题 I configurred S3 bucket for Frankfurt region. Though my Django -based service is able to write files to the bucket, whenever it tried to read them there's InvalidRequest error telling to upgrate authorization mechanizm: <Error> <Code>InvalidRequest</Code> <Message> The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256. </Message> <RequestId>17E9629D33BF1E24</RequestId> <HostId> ... </HostId> </Error> Is the cause for this error burried in my incorrect

TypeError : “errorMessage”: “argument should be a bytes-like object or ASCII string, not 'Binary'”,

佐手、 提交于 2020-01-15 15:08:05
问题 I tried another program to validate the saved list of username and encrypted password from the above table and username and allowed resources in a different table. This program needs to be integrated with API request, however I have changed to send event test parameters from lambda test config, I tried the same for decoding as guided in the previous comments. Based on the previous error and comments, I was able to resolve that. "errorMessage": "string argument without an encoding", TypeError:

Upload a base64 string(Image Data) to S3 server in Python using Boto3 and get URL in return

*爱你&永不变心* 提交于 2020-01-14 17:42:55
问题 I am trying to upload a base 64 string , which is basically image data to an S3 bucket using Python. I have googled and got a few answers but none of them works for me. And some answers use boto and not boto3, hence they are useless to me. I have also tried this link: Boto3: upload file from base64 to S3 but it is not working for me as Object method is unknown to the s3. Following is my code so far: import boto3 s3 = boto3.client('s3') filename = photo.personId + '.png' bucket_name = 'photos

Upload a base64 string(Image Data) to S3 server in Python using Boto3 and get URL in return

戏子无情 提交于 2020-01-14 17:39:13
问题 I am trying to upload a base 64 string , which is basically image data to an S3 bucket using Python. I have googled and got a few answers but none of them works for me. And some answers use boto and not boto3, hence they are useless to me. I have also tried this link: Boto3: upload file from base64 to S3 but it is not working for me as Object method is unknown to the s3. Following is my code so far: import boto3 s3 = boto3.client('s3') filename = photo.personId + '.png' bucket_name = 'photos

Using Boto3 to interact with amazon Aurora on RDS

故事扮演 提交于 2020-01-14 07:17:19
问题 I have set up a database in Amazon RDS using Amazon Aurora and would like to interact with the database using Python - the obvious choice is to use Boto. However, their documentation is awful and does nopt cover ways in which I can interact with the databse to: Run queries with SQL statements Interact with the tables in the database etc Does anyone have an links to some examples/tutorials, or know how to do these tasks? 回答1: When using Amazon RDS offerings (including Aurora), you don't