I have been trying to start a Windows guest in AWS EC2, and can't figure 
out how to get the password in the Vagrantfile.

With Linux, I see this is used :
    override.ssh.private_key_path = "test-ec2-1.pem"

But this doesn't seem to work for Windows guests in AWS EC2. I think it is 
because it uses WinRm, not SSH. How can I get the password passed into the 
Vagrantfile ?

I see messages like this when I do : vagrant up --provider=aws --debug :

DEBUG winrmshell: initializing WinRMShell
DEBUG winrmshell: powershell executing:
hostname
if ($?) { exit 0 } else { if($LASTEXITCODE) { exit $LASTEXITCODE } else { 
exit 1 } }
 INFO winrmshell: Attempting to connect to WinRM...
 INFO winrmshell:   - Host: xxx.xxx.xxx.xxx (masked)
 INFO winrmshell:   - Port: 5985
 INFO winrmshell:   - Username: Administrator
 INFO retryable: Retryable exception raised: 
#<WinRM::WinRMHTTPTransportError: Bad HTTP response returned from server 
(401).>

My Vagrantfile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "dummy"
  config.vm.box_url = 
"https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box";
  config.vm.communicator = "winrm"
  config.winrm.username = "Administrator"

  config.vm.provider :aws do |aws, override|
    aws.access_key_id = ENV['AWS_ACCESS_KEY_ID']
    aws.secret_access_key = ENV['AWS_SECRET_ACCESS_KEY']
    aws.keypair_name = ENV['AWS_KEYPAIR_NAME']
    aws.ami = "ami-e189c8d1"
    aws.security_groups = [ 'vagrant' ]
    aws.region = "us-west-2"
    aws.instance_type = "t2.micro"
  end
end

To get the password, I use the AWS console and Right Click a running 
Instance and click Get Password. Than I need to give it my .pem file and it 
gives me the cryptic password I can use to RDP into the instance. I would 
like a way to use the .pem file in my Vagrantfile. Or maybe there is 
another way?

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to