Amazon web services 如何使用amazon CLI(Powershell)启动并连接到正在运行的amazon windows实例错误:WinRM

Amazon web services 如何使用amazon CLI(Powershell)启动并连接到正在运行的amazon windows实例错误:WinRM,amazon-web-services,amazon-ec2,Amazon Web Services,Amazon Ec2,我正在尝试连接到已经运行的AmazonWindows实例,并且我正在尝试通过AmazonPowerShell创建实例。我尝试使用下面的命令创建 Example: aws ec2 run-instances --image-id ami-555555 --count 1 --key-name KEYNAME --subnet-id subnet-777777 --security-group-ids sg-5555566 --instance-type t2.medium 它正在启动实例,但

我正在尝试连接到已经运行的AmazonWindows实例,并且我正在尝试通过AmazonPowerShell创建实例。我尝试使用下面的命令创建

 Example:  aws ec2 run-instances --image-id ami-555555 --count 1 --key-name KEYNAME --subnet-id subnet-777777 --security-group-ids sg-5555566 --instance-type t2.medium
它正在启动实例,但我真的不知道如何连接它

PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> enable-psremoting
PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> $cred = get-credential -username "Administrator" -message "password"
PS C:\Program Files (x86)\AWS Tools\PowerShell\AWSPowerShell> $sess = new-pssession -computername My IP4 address goes here -credential $cred -authentication default
new-pssession : [x.x.x.x] Connecting to remote server [x.x.x.x] failed with the following error message : The WinRM client cannot process the
request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or
the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the
TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more
information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:9
+ $sess = new-pssession -computername [x.x.x.x] -credential $cred - ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
    + FullyQualifiedErrorId : ServerNotTrusted,PSSessionOpenFailed

我看到上面的错误。请帮助我如何连接到我的实例。任何关于这方面的建议都会很有帮助。提前感谢。

您使用的是创建实例时使用的相同ssh密钥pem吗?是的,我使用的是相同的ssh密钥pem。我通过此链接通过powershell连接到windows server 2016实例。但我一直收到以下错误:Enter PSSession:连接到远程服务器x.x.x.x失败,错误消息如下:WinRM无法完成操作。请验证指定的计算机名是否有效,计算机是否可以通过网络访问,以及是否启用了WinRM服务的防火墙例外并允许从此计算机进行访问。@SantiagoQuinteros能否请您帮助我使用AWS命令使用amazon powershell连接到实例