Search code examples
python-3.xamazon-ec2ansibleboto

ANSIBLE: boto - "TypeError: a bytes-like object is required, not 'str'"


Using ansible=2.10.0 and boto=2.49.0, When trying to execute ec2_vol playbook for manage disk to AWS instance with Proxy environment. Getting this error -

connection.py",line 796, in proxy_ssl, sock.sendall("CONNECT %s HTTP/1.0\r\n" % host), TypeError: a bytes-like object is required, not 'str',

There is open PR to boto to fix it, But not merged yet - https://github.com/boto/boto/pull/3699. There is community module is also not available for ec2_vol like - https://galaxy.ansible.com/community/aws.

Is there any solution other than using fork to resolve it like monkeypatching in python?


Solution

  • After long R&D, I have found the solution of above error -

    We can use the amazon.aws:1.4.1 version to resolve the issue. I was not throwing an error as above of the ec2_vol task.