Saturday, April 23, 2022

Amazon linux 2 spin up vagrant with NAT and Bridged Public IP

 vagrant file:

Vagrant.configure("2") do |config|
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # This refers to a local `.box` file which should have been generated by running sets in README.md
  config.vm.box = "uday1kiran/amazonlinux2"
# Vagrant has a default synced folder which you might choose to disable config.vm.synced_folder ".", "/vagrant", disabled: true # This custom built box is not setup to support updates anyway, hence they are been disabled config.vm.box_check_update = false config.vm.network "public_network", bridge: "Intel(R) Dual Band Wireless-AC 8260" end

Vagrant file:
Vagrant.configure("2") do |config|
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # This refers to a local `.box` file which should have been generated by running sets in README.md
  config.vm.box = "uday1kiran/amazonlinux2"
# Vagrant has a default synced folder which you might choose to disable config.vm.synced_folder ".", "/vagrant", disabled: true # This custom built box is not setup to support updates anyway, hence they are been disabled config.vm.box_check_update = false config.vm.network "public_network" end


copy above file in a folder and type 

vagrant up

You can connect using:

vagrant ssh

Or, using public ip using username: vagrant and ssh key 

ssh -i "RootFolderOfVagrantfile\.vagrant\machines\default\virtualbox\private_key" vagrant@192.168.0.4

No comments:

Post a Comment