Create an EC2 key pair

You can associate a specific SSH key pair with control plane or node pool instances during creation.

To generate an asymmetric private key and import its public key into AWS, run the following commands:

ssh-keygen -t rsa -m PEM -b 4096 -C "COMMENT" \
      -f SSH_PRIVATE_KEY -N "" 1>/dev/null

aws ec2 import-key-pair --key-name SSH_KEY_PAIR_NAME \
      --public-key-material fileb://SSH_PRIVATE_KEY.pub

Replace the following:

  • SSH_PRIVATE_KEY: a file name to save the key in
  • SSH_KEY_PAIR_NAME: a name you choose for the key pair
  • COMMENT: a text string describing the key

What's next