Unable to sync folder from Windows 10 host to Windows EC2 guest using SMB

166 views
Skip to first unread message

Dean Egan

unread,
Aug 9, 2018, 12:39:24 PM8/9/18
to Vagrant
Hello,

I am having severe hardship using Vagrant to sync folders from my Windows 10 host machine to my Windows Ec2 instance using SMB and I would really apricate any guidance on this! 
In the Vagrant file, I have:
config.vm.synced_folder '.', '/vagrant', disabled: false, type: "smb", smb_host: "My_Company's Domain_Name/My_Public_IP", mount_options: ['vers=3.0']
When I run Vagrant up, it says I will be asked for my username password of my account.
I have researched this and it says the username is the account you are logged in to your machine as (which is "admin"). It then said if I am using a Domain, then the username is username@domain

It eventually throws the following error:
The following WinRM command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

cmdkey /add:Company'sDomain/My_Public_IP /user:admin@company's_domain /pass:*****
Stdout from the command:

CMDKEY: The parameter is incorrect.


Can someone please tell me how I am configuring this wrong?

Kind Regards,
Dean

Alvaro Miranda Aguilera

unread,
Aug 13, 2018, 3:43:21 AM8/13/18
to vagra...@googlegroups.com
Hello.

Assuming you are using vagrant-aws plugin, I would suggest you first locally.

If you could find a Windows box on vagrant cloud and use virtualbox, so you can confirm what you want to do works, then on AWS should be straightforward.

It may due the box in AWS have some restriction or firewalls.

Alvaro.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
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 vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/d8c7b478-3dfc-4c31-9e29-ffde727b36db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Alvaro

Dean Egan

unread,
Aug 13, 2018, 6:15:05 AM8/13/18
to Vagrant
Hi Alvaro,
Thank you for your reply!
I have been using Vagrant with Virtual Box for a while now and I have no trouble with folder syncing.

I used Packer to create an aws box file and use Vagrant to point to the box file along with using my custom ami ID.
Here is the output of my Packer config:
PS C:\qmi\AWS-base-os> packer build -only=amazon-ebs EC2.json
amazon-ebs output will be in this color.
==> amazon-ebs: Prevalidating AMI Name: cc_QlikSense2
    amazon-ebs: Found Image ID: ami-9bb358fc
==> amazon-ebs: Using existing SSH private key
==> amazon-ebs: Creating temporary security group for this instance: packer_5b714be2-9d46-f5d5-8cae-b72236b3a7f3
==> amazon-ebs: Authorizing access to port 5985 from 0.0.0.0/0 in the temporary security group...
==> amazon-ebs: Launching a source AWS instance...
==> amazon-ebs: Adding tags to source instance
    amazon-ebs: Adding tag: "Name": "Packer Builder"
    amazon-ebs: Instance ID: i-0dddecd1c4d7cb0eb
==> amazon-ebs: Waiting for instance (i-0dddecd1c4d7cb0eb) to become ready...
==> amazon-ebs: Skipping waiting for password since WinRM password set...
==> amazon-ebs: Waiting for WinRM to become available...
    amazon-ebs: WinRM connected.
    amazon-ebs: #< CLIXML
    amazon-ebs: <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj><Obj S="progress" RefId="1"><TNRef RefId="0" /><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>
==> amazon-ebs: Connected to WinRM!
==> amazon-ebs: Stopping the source instance...
    amazon-ebs: Stopping instance, attempt 1
==> amazon-ebs: Waiting for the instance to stop...
==> amazon-ebs: Creating the AMI: cc_QlikSense2
    amazon-ebs: AMI: ami-<AMIID>
==> amazon-ebs: Waiting for AMI to become ready...
==> amazon-ebs: Terminating the source AWS instance...
==> amazon-ebs: Cleaning up any extra volumes...
==> amazon-ebs: No volumes to clean up, skipping
==> amazon-ebs: Deleting temporary security group...
==> amazon-ebs: Running post-processor: vagrant
==> amazon-ebs (vagrant): Creating Vagrant box for 'aws' provider
    amazon-ebs (vagrant): Compressing: Vagrantfile
    amazon-ebs (vagrant): Compressing: metadata.json
Build 'amazon-ebs' finished.
==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs: AMIs were created:
eu-west-2: ami<amid>
--> amazon-ebs: 'aws' provider box: packer_amazon-ebs_aws.box

I manged to get Vagrant to create the SMB folder using the below commands:
config.vm.synced_folder '.', '/vagrant', disabled: false, type: "smb", smb_host: "172.31.23.217", mount_options: ['vers=3.0']
    config.vm.synced_folder "./files", "c:/installations/", disabled: false, type: "smb", smb_host: "172.31.23.217", mount_options: ['vers=3.0']
    config.vm.synced_folder sharedContentRelativePath, "c:/shared-content/", disabled: false, type: "smb", smb_host: "172.31.23.217", mount_options: ['vers=3.0']

It created the three folders on the EC2 instance, however when I try to open the folders on the EC2 instance, I get the following error:
"Location is not available. C:\vagrant is not accessible. The network name cannot be found"

There are a few scripts and other files in these folders and when the provisioner runs, I get an error saying the files don't exist.
I think the reason that happens is because of the above error.

Would you know why I get these errors?

Kind Regards,
Dean

Alvaro Miranda Aguilera

unread,
Aug 13, 2018, 4:54:38 PM8/13/18
to vagra...@googlegroups.com
I understand correctly

you want to mount "172.31.23.217" into the AWS EC2 Ami.

Can the AMI reach "172.31.23.217" ?

Or I got this wrong?



For more options, visit https://groups.google.com/d/optout.


--
Alvaro

Dean Egan

unread,
Aug 13, 2018, 5:01:02 PM8/13/18
to vagra...@googlegroups.com
Not quiet.
172.31.23.217 is the IP address of my EC2 instance.
I want to mount and sync three folders from my host (my Windows 10 pc) to my guest (windows server 2016 EC2).

Should the IP address of the EC2 instance not be in the Vagrant config line?

I had my own machine's IP address instead of the EC2 one before, but I still got the error of not being able to open the folders on the EC2 instance.

Kind regards,
Dean

Alvaro Miranda Aguilera

unread,
Aug 13, 2018, 5:18:20 PM8/13/18
to vagra...@googlegroups.com
if you are using vagrant-aws plugin, i would expect this to work as long there is direct connectivity/firewall for the required ports.


alvaro


For more options, visit https://groups.google.com/d/optout.


--
Alvaro

Dean Egan

unread,
Aug 13, 2018, 5:22:57 PM8/13/18
to vagra...@googlegroups.com
Hi Alvaro,

Are you taking about port 445 that has to be open?
And are you saying that having the IP address of the EC2 instance in my SMB host config in my Vagrant file is correct?

I am currently using the AWS plugin.

Kind regards,
Dean

Reply all
Reply to author
Forward
0 new messages