无法登录使用 AMI 创建的 amazion ec2

无法登录使用 AMI 创建的 amazion ec2

我无法使用密码登录我的 aws ec2 实例

我会在这里解释我做了什么

  1. 创建新的 aws ec2 实例(删除密钥登录并启用密码登录)
  2. 创建图像
  3. 再次使用之前创建的 AMI 创建新实例

然后我尝试通过 ssh 登录新创建实例,但我无法登录,如何登录?(在新实例中)

答案1

试试这个。在文件的两个位置设置相同的以太网卡 MAC 地址。如果需要,调整 eth0。

# This file is generated from information provided by the datasource.  Changes
# to it will not persist across an instance reboot.  To disable cloud-init's
# network configuration capabilities, write a file
# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
# network: {config: disabled}
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      match:
        macaddress: 06:bf:0c:4a:a5:d6
      set-name: eth0
  bridges:
    br0:
      dhcp4: true
      macaddress: 06:bf:0c:4a:a5:d6
      interfaces:
        - eth0

笔记:您可能需要创建/etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

network: {config: disabled}

sudo netplan --debug generate

sudo netplan apply

reboot# 强制的

https://cloudinit.readthedocs.io/en/latest/topics/faq.html

相关内容