How to do it...

  1. Create the key pair, and save it to disk:
      aws ec2 create-key-pair \        --key-name MyEC2KeyPair \        --query 'KeyMaterial' \        --output text > ec2keypair.pem
  1. Change the permissions on the created file:
        chmod 600 ec2keypair.pem

Get AWS Administration Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.