這個問題搞了我2天時間,所以要好好記錄一下。對于Windows Server 2012之前和Server 2016之后的處理方式是不一樣的,我在誤打誤撞中,用了2012的方法解決了2016的問題, 因為我不知道忘記密碼的EC2是2016版本。
而且Windows的這類問題(忘記key pair和密碼)的處理方式比Linux的要復雜。
商水網站建設公司成都創(chuàng)新互聯,商水網站設計制作,有大型網站制作公司豐富經驗。已為商水成百上千家提供企業(yè)網站建設服務。企業(yè)網站搭建\成都外貿網站建設要多少錢,請找那個售后服務好的商水做網站的公司定做!



創(chuàng)建一個新的EC2 Instance,tag標記為new-instance


以下這步很關鍵,之前的嘗試我都弄錯了









另外我之前看文檔說可以通過修改Ec2Config service來實現密碼修改,后來摸索后才發(fā)現這在2012及之前的版本才可以,而我的忘記密碼的服務器是2016版本,這也是我奇怪之前沒有在路徑下看到C:\Program Files\Amazon\Ec2ConfigService這個文件夾了,所以我從2012上copy了一個到這個路徑,同時修改了config.xml文件,把EC2Password改為Enabled,不知道跟這個有沒關系,權且記錄在案。



參考文檔
適用于server 2012及其前版本:https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Config.html
適用于server 2016及其后版本:https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ResettingAdminPassword_EC2Launch.html
這個提到要完全按照步驟來,我也是受這個啟發(fā),重新看文檔才發(fā)現我沒有l(wèi)aunch image,而是搞了launch new instance,這點很關鍵。https://stackoverflow.com/questions/50686939/resetting-administrator-password-for-aws-ec2-windows-server-2012-instance
后來收到AWS Support發(fā)來的郵件支持信息,不過我的問題已經自己解決,所以沒有使用他們的方法,記錄如下:
對于server 2016
In the Amazon IAM Console (https://console.aws.amazon.com/iam/), in the navigation pane, choose Roles, Create new role.
Choose Amazon EC2 Role for Simple Systems Manager, and then choose Select.
Under Policy Name, check AmazonEC2RoleforSSM, Next Step, enter a Role name that is meaningful to you and choose Create Role.
Open the Amazon EC2 console, https://console.aws.amazon.com/ec2/ and choose the appropriate region.
Select the affected instance, choose Actions, Instance Settings, Attach/Replace IAM role. This would attach the IAM role you just created to your instance.
From EC2 console select, "Run Command" and "Run a command" option.
Select "AWS-RunPowershellScript" from Command document
In Select Targets, Select the instance you want to reset password for. Should the instance not be populated in the list, please wait for some time so that the changes can be propagated.
Under Commands, run the following command while replacing "new_password" with your password.
net user Administrator new_password
Following the successful completion of the run command, you should now be able to log in with that local administrator password you just keyed in under step 9. Once you've regained access to the instance, change the password to a more permanent value by running the command from step 9 again in command prompt of the instance.
Another procedure you can follow to reset the password on the instance is to use the AWSSupport-ResetAccess Automation document from the Systems Manager console. This document is useful if you have lost your EC2 key pair and want to create a password-enabled AMI from your EC2 instance, so you can launch a new instance with an existing key pair. To perform this, you can follow the steps given on the link under the section headed "Systems Manager Automation AWSSupport-ResetAccess (Offline Method)":
[+] https://aws.amazon.com/premiumsupport/knowledge-center/reset-admin-password/
網頁標題:WindowsEC2Instance忘記密碼如何重置
轉載來于:http://www.chinadenli.net/article24/gspije.html
成都網站建設公司_創(chuàng)新互聯,為您提供品牌網站設計、外貿網站建設、品牌網站建設、虛擬主機、網站策劃、網站排名
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯