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

290 views Asked by At

I am trying to register a domain on SWF using boto. But it's throwing me this error.

    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'}

Also, In CLI.

aws swf list-domains --registration-status REGISTERED

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',))

Everything is working perfectly on other AWS region. But it not working in AWS GovCloud (US) Region.

Thanks in advance.

2

There are 2 answers

1
Jumping Qu On BEST ANSWER

You may add region in boto config file like as

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

Are you aware your regular AWS credentials will not work in GovCloud? It is a separate account and has totally different credentials.

Assuming you are indeed using the correct credentials, the SWF endpoint you (or Boto) is connecting to is incorrect. It is connecting to swf.swf.us-gov-west-1.amazonaws.com.amazonaws.com instead of 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