Update docs
This commit is contained in:
parent
45908905a2
commit
e3a886b3a1
@ -84,24 +84,26 @@ EC2 上的每个 Linux 服务器发行版本都有它自己的默认登录用户
|
|||||||
|
|
||||||
1. 在 **Outputs** 页面下拷贝密钥对 ID ,然后使用以下命令来提取私钥内容并且将其保存为一个证书文件:
|
1. 在 **Outputs** 页面下拷贝密钥对 ID ,然后使用以下命令来提取私钥内容并且将其保存为一个证书文件:
|
||||||
|
|
||||||
> **注:** 在使用以下命令前,你需要在你的电脑上正确的安装和配置好 AWS 命令行。更多关于开始使用 AWS 命令行的信息,请参照 [Get started with the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) 。
|
> **注:** 在使用以下命令前,你需要在你的电脑上正确的安装和配置好 AWS 命令行。更多关于开始使用 AWS 命令行的信息,请参照 [Get started with the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html) 。
|
||||||
|
|
||||||
```
|
```
|
||||||
$ aws ssm get-parameter --region your-region --name /ec2/keypair/your-key-pair-id --with-decryption --query Parameter.Value --output text > new-key-pair.pem
|
$ aws ssm get-parameter --region your-region --name /ec2/keypair/your-key-pair-id --with-decryption --query Parameter.Value --output text > new-key-file.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
![显示密钥 ID](images/show-key-id.png)
|
![显示密钥 ID](images/show-key-id.png)
|
||||||
|
|
||||||
2. 直接从 **Outputs** 页面拷贝私钥对内容 ,然后将其保存入一个证书文件。请注意在保存到你的计算机之前,你可能需要修改私钥的格式,比如用换行符替换所有的空格。在保存后,需要为该私钥文件设置[适当的权限](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/connection-prereqs.html#connection-prereqs-private-key)才能使用。
|
2. 直接从 **Outputs** 页面拷贝私钥对内容 ,然后将其保存入一个证书文件。请注意在保存到你的计算机之前,你可能需要修改私钥的格式,比如用换行符替换所有的空格。在保存后,需要为该私钥文件设置[适当的权限](https://docs.aws.amazon.com/zh_cn/AWSEC2/latest/UserGuide/connection-prereqs.html#connection-prereqs-private-key)才能使用。
|
||||||
|
|
||||||
![显示密钥内容](images/show-key-id.png)
|
![显示密钥内容](images/show-key-id.png)
|
||||||
|
|
||||||
要为私钥文件设置适当的权限,请在该文件所在的目录下运行以下命令:
|
要为私钥文件设置适当的权限,请在该文件所在的目录下运行以下命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo chmod 400 new-key-file.pem
|
$ sudo chmod 400 new-key-file.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 SSH 登录到 EC2 实例的示例命令:
|
使用 SSH 登录到 EC2 实例的示例命令:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ssh -i path/to/your/new-key-file.pem instance-username@instance-ip-address
|
$ ssh -i path/to/your/new-key-file.pem instance-username@instance-ip-address
|
||||||
```
|
```
|
||||||
|
@ -84,24 +84,26 @@ This template generates a key pair for you during deployment, and to acquire the
|
|||||||
|
|
||||||
1. Copy the key pair ID displayed under the **Outputs** tab, and use the following command to retrieve the private key material and save it into a certificate file:
|
1. Copy the key pair ID displayed under the **Outputs** tab, and use the following command to retrieve the private key material and save it into a certificate file:
|
||||||
|
|
||||||
> **Note:** You need to first properly set up the AWS CLI on your computer before using the following command. For more information on how to get started with AWS CLI, please refer to [Get started with the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html).
|
> **Note:** You need to first properly set up the AWS CLI on your computer before using the following command. For more information on how to get started with AWS CLI, please refer to [Get started with the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html).
|
||||||
|
|
||||||
```
|
```
|
||||||
$ aws ssm get-parameter --region your-region --name /ec2/keypair/your-key-pair-id --with-decryption --query Parameter.Value --output text > new-key-file.pem
|
$ aws ssm get-parameter --region your-region --name /ec2/keypair/your-key-pair-id --with-decryption --query Parameter.Value --output text > new-key-file.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
![Show key ID](images/show-key-id.png)
|
![Show key ID](images/show-key-id.png)
|
||||||
|
|
||||||
2. Copy the private key material directly from the **Outputs** tab, and save it into a certificate file. Note that You may need to format the private key by replacing all spaces with newlines, before saving to a file. The file will need to be set with [proper permissions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connection-prereqs.html#connection-prereqs-private-key) before using.
|
2. Copy the private key material directly from the **Outputs** tab, and save it into a certificate file. Note that You may need to format the private key by replacing all spaces with newlines, before saving to a file. The file will need to be set with [proper permissions](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connection-prereqs.html#connection-prereqs-private-key) before using.
|
||||||
|
|
||||||
![Show key material](images/show-key.png)
|
![Show key material](images/show-key.png)
|
||||||
|
|
||||||
To apply proper permissions to your private key file, run the following command under the directory where the file is located:
|
To apply proper permissions to your private key file, run the following command under the directory where the file is located:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo chmod 400 new-key-file.pem
|
$ sudo chmod 400 new-key-file.pem
|
||||||
```
|
```
|
||||||
|
|
||||||
Example command to login to your EC2 instance using SSH:
|
Example command to login to your EC2 instance using SSH:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ssh -i path/to/your/new-key-file.pem instance-username@instance-ip-address
|
$ ssh -i path/to/your/new-key-file.pem instance-username@instance-ip-address
|
||||||
```
|
```
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 427 KiB After Width: | Height: | Size: 287 KiB |
Loading…
Reference in New Issue
Block a user