Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codedeploy agent for Windows won't install | ERROR: a bytes-like object is required, not 'str' #215

Closed
msegzda opened this issue May 30, 2019 · 9 comments

Comments

@msegzda
Copy link

msegzda commented May 30, 2019

I use instructions from https://github.com/awsdocs/aws-codedeploy-user-guide/blob/master/doc_source/instances-on-premises-register-instance.md#step-2-call-the-register-command to register Windows 2012 R2 on-premise instance for use with AWS CodeDeploy.

I keep getting a bytes-like object is required, not 'str' error when installing agent:

aws deploy install --override-config --config-file "C:\temp\codedeploy.onpremises.yml" --region eu-west-1

Returns me this:

Creating the on-premises instance configuration file... DONE
Installing the AWS CodeDeploy Agent... ERROR
a bytes-like object is required, not 'str'

Here are the versions i'm using:

CLI version: aws-cli/1.16.168 Python/3.6.0 Windows/2012ServerR2 botocore/1.12.158

When executed with --debug option there is nothing special returned prior the error. Here it goes:

2019-05-30 13:51:16,594 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2019-05-30 13:51:16,594 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2019-05-30 13:51:16,594 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2019-05-30 13:51:16,594 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2019-05-30 13:51:16,594 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\data\endp
oints.json
2019-05-30 13:51:16,594 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x000000C4116D
A0D0>
2019-05-30 13:51:16,594 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\data\s3\2
006-03-01\service-2.json
2019-05-30 13:51:16,610 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.s3: calling handler <function add_generate_presigned_post at 0x00000
0C411687840>
2019-05-30 13:51:16,610 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.s3: calling handler <function add_generate_presigned_url at 0x000000
C411687620>
2019-05-30 13:51:16,610 - MainThread - botocore.args - DEBUG - The s3 config key is not a dictionary type, ignoring its value of: None
2019-05-30 13:51:16,625 - MainThread - botocore.endpoint - DEBUG - Setting s3 timeout as (60, 60)
2019-05-30 13:51:16,625 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\data\_ret
ry.json
2019-05-30 13:51:16,625 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: s3
2019-05-30 13:51:16,625 - MainThread - botocore.client - DEBUG - Defaulting to S3 virtual host style addressing with path style addressing fallback.
Creating the on-premises instance configuration file... DONE
Installing the AWS CodeDeploy Agent... ERROR
a bytes-like object is required, not 'str'

Can you please advice?

@kwcrook
Copy link

kwcrook commented May 30, 2019

I'm getting this as well on Ubuntu Server 18.04 (Perhaps it's a ruby version issue?).

Anyway, for a workaround (for linux) I installed it manually using the instructions here:
https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-ubuntu.html

The Windows ones may work for you better than the automated install? https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install-windows.html

The instructions are incomplete however if you are using an on-prem server. You will need to copy your codedeploy.onpremises.yml file into the same directory as the codedeploy-agent config file.

@msegzda
Copy link
Author

msegzda commented Jun 4, 2019

Stand alone installer worked. Good for me for now

@genifycom
Copy link

genifycom commented Nov 1, 2020

This is still not fixed.

aws deploy install --config-file C:\myapp\codedeploy.onpremises.yml --override-config
Creating the on-premises instance configuration file... DONE
Installing the AWS CodeDeploy Agent... ERROR
a bytes-like object is required, not 'str'
Install the AWS CodeDeploy Agent on the on-premises instance by following the instructions in "Configure Existing On-Premises Instances by Using AWS CodeDeploy" in the AWS CodeDeploy User Guide.

@philstrong
Copy link
Contributor

@philstrong
Copy link
Contributor

philstrong commented Nov 3, 2020

Try using CLI 2.0 that should fix this issue. CLI 2.0 should support Python 3.

@genifycom
Copy link

aws-cli/2.4.15 Python/3.8.8 Windows/10 exe/AMD64 prompt/off

Installing the AWS CodeDeploy Agent... ERROR
a bytes-like object is required, not 'str'

@genifycom
Copy link

aws-cli/2.4.27 Python/3.8.8 Windows/10 exe/AMD64 prompt/off

Still not fixed

Creating the on-premises instance configuration file... DONE
Installing the AWS CodeDeploy Agent... ERROR
a bytes-like object is required, not 'str'

@mwjones-aws
Copy link
Contributor

Hi,

We recommend you install CodeDeploy Agent via SSM, or by downloading it from S3. These work for Ruby versions up to 2.7. More details can be found here: https://docs.aws.amazon.com/codedeploy/latest/userguide/codedeploy-agent-operations-install.html

For on-premise instances, you still need to call these APIs to register and add tags to each instance:

@mwjones-aws
Copy link
Contributor

You can use aws deploy register CLI command to register and tag your on-premise instances.

@mwjones-aws mwjones-aws closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants