boto3

How to get results from a HIT on sandbox via Mturk API

杀马特。学长 韩版系。学妹 提交于 2021-01-27 06:44:31
问题 I have created an XML file to publish a question to MTurk and the HIT is visible in the worker sandbox. A couple of my friends even submitted responses to the HIT, but I'm unable to view the results of this HIT. Here's the code I used to publish the HIT: import boto3 MTURK_SANDBOX = 'https://mturk-requester-sandbox.us-east-1.amazonaws.com' MTURK_PROD = 'https://mturk-requester.us-east-1.amazonaws.com' mturk = boto3.client('mturk', aws_access_key_id = "blah", aws_secret_access_key = "blah",

AWS EC2 Instance stopping right after start using boto3

浪尽此生 提交于 2021-01-27 04:07:09
问题 Using boto3 run_instances The instance is stopping after 30 sec by itself and the State transition reason in the console shows: Client.InstanceInitiatedShutdown: Instance initiated shutdown What might be the issue? 回答1: Check if your AMI type (PV or HVM) and the volumes are compatible and you are mounting the volumes to the correct device . If there is a compatibility issue, the instance shuts down with Client.InstanceInitiatedShutdown: Instance initiated shutdown 来源: https://stackoverflow

Transfer file from SFTP to S3 using Paramiko

狂风中的少年 提交于 2021-01-24 09:52:08
问题 I am using Paramiko to access a remote SFTP folder, and I'm trying to write code that transfers files from a path in SFTP (with a simple logic using the file metadata to check it's last modified date) to AWS S3 bucket. I have set the connection to S3 using Boto3, but I still can't seem to write a working code that transfers the files without downloading them to a local directory first. Here is some code I tried using Paramiko's getfo() method. But it doesn't work. for f in files: # get last

Sending sms notification to multiple phone number using SNS with boto3

跟風遠走 提交于 2021-01-07 06:34:48
问题 I am trying to send an event-driven notification through SMS using aws SNS. I am trying to write a script to send a message to a single number first. Here is my below code for that import json import boto3 def lambda_handler(event, context): client = boto3.client("sns") response = client.publish( PhoneNumber="+91 xxxxxxxxxx", Message="Hello World!" ) print (response) # TODO implement return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } The thing here is I am not getting any

Sending sms notification to multiple phone number using SNS with boto3

送分小仙女□ 提交于 2021-01-07 06:33:41
问题 I am trying to send an event-driven notification through SMS using aws SNS. I am trying to write a script to send a message to a single number first. Here is my below code for that import json import boto3 def lambda_handler(event, context): client = boto3.client("sns") response = client.publish( PhoneNumber="+91 xxxxxxxxxx", Message="Hello World!" ) print (response) # TODO implement return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } The thing here is I am not getting any

Sending sms notification to multiple phone number using SNS with boto3

我的未来我决定 提交于 2021-01-07 06:33:32
问题 I am trying to send an event-driven notification through SMS using aws SNS. I am trying to write a script to send a message to a single number first. Here is my below code for that import json import boto3 def lambda_handler(event, context): client = boto3.client("sns") response = client.publish( PhoneNumber="+91 xxxxxxxxxx", Message="Hello World!" ) print (response) # TODO implement return { 'statusCode': 200, 'body': json.dumps('Hello from Lambda!') } The thing here is I am not getting any

Adding new attribute to DynamDB table with updateItem

╄→尐↘猪︶ㄣ 提交于 2021-01-05 11:26:31
问题 I have table already and I want to add a new attribute to that table. I am trying to do that with the update_item functionality of dynamDB. use case: Bid table holds details on the bid of the product. The user accepts the bid, once the bid is accepted, have to add a few attributes to that record like the user information. Not sure if it is the right way or should I have a new table for this. pratition key is : Pickup, sort key is : DropOff A Demo example that I am trying currently currently

botocore.exceptions.SSLError: SSL validation failed

孤街醉人 提交于 2021-01-04 09:25:52
问题 Meta Python: 2.7.5 Pip : pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) AWS CLI : aws-cli/1.16.104 Python/2.7.5 Linux/3.10.0-862.3.3.el7.x86_64 botocore/1.12.94 Boto3 : 1.9.94 Centos : CentOS Linux release 7.5.1804 (Core) My script import boto3 from botocore.exceptions import ClientError ec2 = boto3.client('ec2') try: response = ec2.describe_instances() print(response) except ClientError as e: print(e) When I run my script, I get this exception : botocore.exceptions.SSLError:

botocore.exceptions.SSLError: SSL validation failed

Deadly 提交于 2021-01-04 09:25:14
问题 Meta Python: 2.7.5 Pip : pip 18.1 from /usr/lib/python2.7/site-packages/pip (python 2.7) AWS CLI : aws-cli/1.16.104 Python/2.7.5 Linux/3.10.0-862.3.3.el7.x86_64 botocore/1.12.94 Boto3 : 1.9.94 Centos : CentOS Linux release 7.5.1804 (Core) My script import boto3 from botocore.exceptions import ClientError ec2 = boto3.client('ec2') try: response = ec2.describe_instances() print(response) except ClientError as e: print(e) When I run my script, I get this exception : botocore.exceptions.SSLError:

How to prevent my app from hanging when parallelising paramiko.SFTPClient.get requests?

心已入冬 提交于 2021-01-01 09:11:36
问题 I am trying to parallelise retrieval of files from a server via SFTP and upload to AWS. I am using python multi-threading, the upload part works fine, however, I noticed that the get operation from paramiko.SFTPClient keeps the program hanging at the end. In fact, all of the files are withdrawn and uploaded but the program doesn't exit. I tried many things from similar posts but nothing work, my pseudo-code is the following, any help would be welcome: def create_sftp_connection(host, port,