【问题标题】:Import existing SSH key to AWS EC2 programmatically以编程方式将现有 SSH 密钥导入 AWS EC2
【发布时间】:2017-04-13 13:22:24
【问题描述】:

Importing Your Own Key Pair to Amazon EC2 上的官方文档缺乏关于如何以编程方式生成和导入密钥对的详细信息。

如何做到最好?

【问题讨论】:

    标签: amazon-web-services amazon-ec2 ssh-keys aws-cli


    【解决方案1】:

    创建密钥对(最多 2048 位):

    ssh-keygen -t rsa -b 2048 -C "ec2@aws" -N "" -f ec2_ssh
    chmod 400 ec2_ssh*
    

    将公钥导入 EC2:

    aws ec2 --region=eu-west-1 import-key-pair --key-name ec2_ssh --public-key-material "file://ec2_ssh.pub"
    

    此命令未提及file://... 功能,但它是described here。

    来源:

    【讨论】:

      猜你喜欢
      • 2018-01-02
      • 1970-01-01
      • 1970-01-01
      • 2020-01-10
      • 2018-08-20
      • 2012-01-14
      • 2015-08-22
      • 2021-05-29
      • 1970-01-01
      相关资源
      最近更新 更多