Does anyone know how to fix boto.exception.SWFResponseError: SWFResponseError: 400 Bad Request on AWS GovCloud

Does anyone know how to fix boto.exception.SWFResponseError: SWFResponseError: 400 Bad Request on AWS GovCloud

我正在尝试使用 boto 在 SWF 上注册域。但它抛给我这个错误。

    Traceback (most recent call last):
  File "register.py", line 17, in <module>
    swf_entity.register()
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer2.py", line 67, in register
    self.description)
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer1.py", line 827, in register_domain
    'description': description,
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer1.py", line 118, in json_request
    return self.make_request(action, json_input, object_hook)
  File "/usr/local/lib/python2.7/dist-packages/boto/swf/layer1.py", line 145, in make_request
    raise excp_cls(response.status, response.reason, body=json_body)
boto.exception.SWFResponseError: SWFResponseError: 400 Bad Request
{u'message': u'The security token included in the request is invalid.', u'__type': u'com.amazon.coral.service#UnrecognizedClientException'}

此外,在 CLI 中。

aws swf list-domains --registration-status 已注册

HTTPSConnectionPool(host='swf.swf.us-gov-west-1.amazonaws.com.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x7fae9bafd9b0>: Failed to establish a new connection: [Errno -2] Name or service not known',))

其他 AWS 区域一切正常。但它不适用于 AWS GovCloud(美国)区域。

提前致谢。

您知道您的常规 AWS 凭证在 GovCloud 中不起作用吗?它是一个单独的帐户,具有完全不同的凭据。

假设您确实使用了正确的凭据,那么您(或 Boto)连接到的 SWF 端点不正确。它连接到 swf.swf.us-gov-west-1.amazonaws.com.amazonaws.com 而不是 swf.us-gov-west-1.amazonaws.com

$ host swf.swf.us-gov-west-1.amazonaws.com.amazonaws.com
Host swf.swf.us-gov-west-1.amazonaws.com.amazonaws.com not found: 3(NXDOMAIN)

$ host swf.us-gov-west-1.amazonaws.com
swf.us-gov-west-1.amazonaws.com has address 205.251.239.72

您可以在 boto 配置文件中添加区域,例如

[SWF]
region = us-gov-west-1