AWS Lightsail Instance in CLI

0

I am deploying my first LAMP web app on amazon lightsail using the CLI. I am using windows powershell to interact with CLI. I am attempting to setup an SSH key before creating my instance as the exercise recommends. When I do here is what happens. I can't seem to get past this. Any advice would be appreciated...

aws lightsail create-key-pair \

--key-pair-name LightsailGuide > ssh_key_response.json

cat ssh_key_response.json | jq -r '.publicKeyBase64' > lightsailguide.pub cat ssh_key_response.json | jq -r '.privateKeyBase64' > lightsailguide chmod 400 lightsailguide.pub lightsailguide ********At line:2 char:7

  • --key-pair-name LightsailGuide > ssh_key_response.json
    
  •   ~
    

Missing expression after unary operator '--'. At line:2 char:7

  • --key-pair-name LightsailGuide > ssh_key_response.json
    
  •   ~~~~~~~~~~~~~
    

Unexpected token 'key-pair-name' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingExpressionAfterOperator********

질문됨 2년 전302회 조회
1개 답변
0

Hi , I understand you are trying to setup an SSH key before creating an instance and you are getting an error.Please correct me if I misunderstood.

I replicated this on my end following AWS documentation, using the following command:

aws lightsail create-key-pair \
    --key-pair-name MyPersonalKeyPair

and I got a similar error. However, when I removed the backslash and make the one line command. I was able to create a new key-pair. This is how I did it:

  1. Installed and configured AWS CLI.
  2. I then created my SSH key with the following command on my powershell
aws lightsail create-key-pair --key-pair-name MyPersonalKeyPair > Karabo.json

You can verify that your key was created by going to the Lightsail console then click accounts. Go to SSH keys, your newly created key-pair will be on the list.

I hope this will be helpful!

Karabo
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠