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

import-key-pair fails with ASCII key file #9128

Open
1 task
stephenmsachs opened this issue Dec 10, 2024 · 2 comments
Open
1 task

import-key-pair fails with ASCII key file #9128

stephenmsachs opened this issue Dec 10, 2024 · 2 comments
Assignees
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. ec2 p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@stephenmsachs
Copy link

Describe the bug

As reported here awslabs/ec2-spot-workshops#48 the aws cli command to upload a key using a file name does not generate base64 as it should per the documentation.

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

ssh-keygen -f ${CODEBUILD_BUILD_ID} -P ""
aws ec2 import-key-pair --key-name ${CODEBUILD_BUILD_ID} --public-key-material file://${CODEBUILD_BUILD_ID}.pub

Current Behavior

Invalid base64: "ssh-rsa XXXXXXXXXXX"

Reproduction Steps

Use CodeBuild aws/codebuild/amazonlinux-x86_64-standard:4.0 container and try to add a keypair via CLI.

Possible Solution

As suggested in the linked thread fileb: is used.

Additional Information/Context

No response

CLI version used

1.18.147-1.amzn2.0.2

Environment details (OS name and version, etc.)

AL2

@stephenmsachs stephenmsachs added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 10, 2024
@adev-code adev-code self-assigned this Dec 11, 2024
@adev-code adev-code added investigating This issue is being investigated and/or work is in progress to resolve the issue. ec2 p3 This is a minor priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Dec 11, 2024
@adev-code
Copy link

Hi @stephenmsachs, thank you for reaching out. I have replicated the scenario with CodeBuild and having AWS CLI version aws-cli/1.18.147 and with "file://" without the b and it worked. I was able to import key pair and describe it too. For further look, could you please provide full debug logs and also any other relevant steps you may have done.

In regards to with “b” on "fileb://", it would be for using CLI V2 or you can revert to the v1 behavior with the configuration: cli_binary_format=raw-in-base64-out (#4969 (comment)). This "fileb://" can be seen also from the current documentation: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/import-key-pair.html#examples. Please let me know if you have any other questions. Thank you.

@adev-code adev-code added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Dec 13, 2024
Copy link

Greetings! It looks like this issue hasn’t been active in longer than five days. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

@github-actions github-actions bot added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. closing-soon This issue will automatically close in 4 days unless further comments are made. ec2 p3 This is a minor priority issue response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants