We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

EC2 Instance Configuration: Keys

We need to get the PatientPing application running on a server, but first we need a secure way to connect to that server. Usually, this is done with ssh and a key pair.

Windows servers have extra hoops to jump through (some of them also requiring a key pair), but Linux systems make up the majority of cloud servers, even on Microsoft's Azure, which gives me joy. We'll focus on Linux for this course.

A cryptographic key pair has two parts that work together:

  • The public key is a string of gibberish that you can share with anyone.
  • The private key is another string of gibberish that you must keep secret.

If you've ever used ssh to connect to a server, you probably had to generate a key pair for it. You'll do the same thing to access your AWS server instances.

Assignment

All PatientPing employees need to have their "own" key pair. Let's make one!

Cost check: AWS would probably love to charge by the key pair, but they don't; it's free.

  1. ssh-keygen -t ed25519 -C "patientping-key" -f ~/.ssh/patientping-key
    

    For this use case, do not set a password on the SSH key. Passwords are good IRL to harden security, but it will prevent some of our bootdev tests from working.

  2. aws ec2 import-key-pair --key-name "patientping-key" --public-key-material fileb://$HOME/.ssh/patientping-key.pub
    
  3. aws ec2 describe-key-pairs
    

Run and submit the CLI tests.