Help us understand the problem. What is going on with this article?

[AWS]AWS CLIからSSH用のキーペアを登録する

CLIからECSを構築するときに、SSH KEYってどうやって登録するんやっけみたいなことがあったので。
覚え書きです。

手順

  1. ローカル(Mac)でKeyを作成する。
  2. CLIで鍵をアップロードする。

そう、これだけ!

ローカルで鍵を作成

$ cd ~/.ssh
$ ssh-keygen

Key名をつけたい場合は、1つ目の質問でKey名を入力。
その後パスフレーズの入力が求められます。不要の場合は、そのままEnter。

AWS CLIからSSH用のキーペアを登録

$ aws ec2 create-key-pair --key-name aws_ecs_key_name --query 'KeyMaterial' --output text >~/.ssh/aws_ecs_key_name.pem

aws_ecs_key_name、aws_ecs_key_name.pemの箇所は、入力したKey名をいれてください。

これで登録されました。
以上でございます。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away