簡體   English   中英

使用私鑰創建打包程序后,AWS AMI無法檢索密碼

[英]AWS AMI cannot retrieve password after packer creation using private key

我正在使用打包程序構建Windows服務器AMI。 使用硬編碼的密碼可以正常工作,但是我嘗試創建AMI,以便自動生成密碼。 我嘗試了下面的建議,並且打包程序日志看起來不錯,它獲得了密碼。

如何使用密鑰對在Packer中創建Windows圖像 在此處輸入圖片說明

但是,當我以terraform形式從AMI創建EC2實例時,與Windows密碼的連接丟失並且無法檢索。 這里缺少什么?

封隔器json

{  
  "builders": [
    {
      "profile" : "blah",
      "type": "amazon-ebs",
      "region": "eu-west-1",
      "instance_type": "t2.micro",
      "source_ami_filter": {
        "filters": {
          "virtualization-type": "hvm",
          "name": "*Windows_Server-2012-R2*English-64Bit-Base*",
          "root-device-type": "ebs"
        },
        "most_recent": true,
        "owners": "amazon"
      },
      "ssh_keypair_name" : "shared.key",
      "ssh_private_key_file" : "./common/sharedkey.pem",
      "ssh_agent_auth" : "true",
      "ami_name": "test-{{timestamp}}",
      "user_data_file": "./common/bootstrap_win.txt",
      "communicator": "winrm",
      "winrm_username": "Administrator"      
    }
  ]
}

最后添加Ec2Config.exe -sysprep可以。

{
      "type": "windows-shell",
      "inline": ["C:\\progra~1\\Amazon\\Ec2ConfigService\\Ec2Config.exe -sysprep"]
}

盡管要小心,但似乎在sysprep之后我的IIS配置無法正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM