Ross Drew
Ross Drew

Reputation: 8246

How do I copy varying filenames into Vagrant box (in a platform independent way)?

I'm trying to use Vagrant to deploy to AWS using the vagrant-aws plugin.

This means I need a box, then I need to add a versioned jar (je.g. myApp-1.2.3-SNAPSHOT.jar) and some statically named files. This also need to be able to work on Windows or Linux machines.

I can use config.vm.synced_folder locally with a setup.sh to move the files I need using wildcards (e.g. cp myApp-*.jar) but the plugin only supports , so only Linux.

TLDR; Is there a way to copy files using wildcards in Vagrant

Upvotes: 0

Views: 44

Answers (1)

Frederic Henri
Frederic Henri

Reputation: 53813

This means I need a box

Yes and No. vagrant heavily relies on the box concept but in the context of AWS provider, the box is a dummy box. the system will look at the aws.* variable to connect to your account.

vagrant will spin an ec2 instance and will connect to it, you need to make sure the instance will be linked with a security group that allows the connection and open the port to your IP (at minimum)

if you are running a provisioner, please note the script is run from the ec2 instance not from your local.

what I suggest is the following: - copy the jar files that are necessary on s3 or somewhere the ec2 instance can easily access them - run the provisioner to fetch the files from this source (s3) - let it go.

If you have quick turnaround of files in development mode, you can push to a git repo that the ec2 instance can pull the files and deploy the jar directly

Upvotes: 1

Related Questions