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********

gefragt vor 2 Jahren306 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen