2017年4月17日 星期一

[aws][sqs] get queue return None / SQS debug

SQS connection get_queue failed in China region · Issue #3440 · boto/boto
https://github.com/boto/boto/issues/3440

可以使用 debug = 2  看一下每一次的 requests
如果是 404 很大可能是這個 key 沒有 access 的權限

conn = boto.sqs.connect_to_region(
    "cn-north-1", aws_access_key_id=key_id, aws_secret_access_key=secret_key, debug=2)
q = conn.get_queue("my_queue_name")
send: 'GET /?Action=GetQueueUrl&QueueName=cloudtrail-bj&Version=2012-11-05 HTTP/1.1\r\nAccept-Encoding: identity\r\nContent-Length: 0\r\nHost: cn-north-1.queue.amazonaws.com.cn\r\nAuthorization: AWS4-HMAC-SHA256 Credential=yyyyyyyyy/20151222/cn-north-1/sqs/aws4_request,SignedHeaders=host;x-amz-date,Signature=xxxxxxxxxx\r\nX-Amz-Date: 20151222T140256Z\r\nUser-Agent: Boto/2.38.0 Python/2.7.10 Darwin/14.5.0\r\n\r\n'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: x-amzn-RequestId: c0b20366-324e-5054-be6c-4d95681e72c2
header: Content-Type: text/xml
header: Content-Length: 343


沒有留言:

張貼留言