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 年前292 查看次数
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 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则