AWS:创建实例后添加密钥对
AWS: add key pair after creating instance
我是 AWS 新手。
我在 EC2 上创建了一个实例。这是一个 Bitnami Wordpress 安装。
我没有意识到我需要一个密钥对,当我添加一个后,它不允许我连接。我得到 "Permission denied (publickey)."
我可以在不丢失 Bitnami WP 安装的情况下断开实例吗?
这样做可以让我添加密钥对吗?
我是否需要创建另一个实例并重做所有内容?
很遗憾,是的。您必须在启动实例时指定 keypair
除非 AMI 带有众所周知的 username/password 并且 SSH 守护进程接受密码和密钥。
事实上,当您继续启动没有 keypair
的实例时,AWS 会警告您。
您可以将实例保存为 ami 图像。这基本上会将实例保存在当前状态,其中包括 bitnami 安装。然后,您可以使用此自定义 ami 创建一个新实例,并在初始配置期间添加一个密钥对。
基本上,如果您正确管理堆栈,有些值可以更改,但有些值则不能。我认为主要是 IP 等?在某些情况下这可能是错误的。这个特别的,link 暗示会起作用。
显然,如果实例尚未从 "Cloud Formation" 中的堆栈创建,它不会有帮助,但您可以在将来做好更多准备。
To add SSH access to an existing Amazon EC2 instance
1) Add two additional parameters to the template to pass in the name
of an existing Amazon EC2 key pair and SSH location.
2) Add the KeyName property to the Amazon EC2 instance.
3) Add port 22 and the SSH location to the ingress rules for the
Amazon EC2 security group.
4) Update the stack, either from the AWS
Management Console as explained in Update the Application or by using
the AWS command aws cloudformation update-stack.
我是 AWS 新手。
我在 EC2 上创建了一个实例。这是一个 Bitnami Wordpress 安装。
我没有意识到我需要一个密钥对,当我添加一个后,它不允许我连接。我得到 "Permission denied (publickey)."
我可以在不丢失 Bitnami WP 安装的情况下断开实例吗?
这样做可以让我添加密钥对吗?
我是否需要创建另一个实例并重做所有内容?
很遗憾,是的。您必须在启动实例时指定 keypair
除非 AMI 带有众所周知的 username/password 并且 SSH 守护进程接受密码和密钥。
事实上,当您继续启动没有 keypair
的实例时,AWS 会警告您。
您可以将实例保存为 ami 图像。这基本上会将实例保存在当前状态,其中包括 bitnami 安装。然后,您可以使用此自定义 ami 创建一个新实例,并在初始配置期间添加一个密钥对。
基本上,如果您正确管理堆栈,有些值可以更改,但有些值则不能。我认为主要是 IP 等?在某些情况下这可能是错误的。这个特别的,link 暗示会起作用。
显然,如果实例尚未从 "Cloud Formation" 中的堆栈创建,它不会有帮助,但您可以在将来做好更多准备。
To add SSH access to an existing Amazon EC2 instance
1) Add two additional parameters to the template to pass in the name of an existing Amazon EC2 key pair and SSH location.
2) Add the KeyName property to the Amazon EC2 instance.
3) Add port 22 and the SSH location to the ingress rules for the Amazon EC2 security group.
4) Update the stack, either from the AWS Management Console as explained in Update the Application or by using the AWS command aws cloudformation update-stack.