这是我的AWS设置:
EC2实例具有到外部networking的连接(通过ping 8.8.8.8validation)。 这是它的路由表:
Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default ip-10-0-0-1.eu- 0.0.0.0 UG 0 0 0 eth0 10.0.0.0 * 255.255.255.0 U 0 0 0 eth0 instance-data.e * 255.255.255.255 UH 0 0 0 eth0
EC2实例也可以连接到RDS实例。
我想要的是使用Vagrant从第一个EC2实例内部启动第二个EC2实例(Amazon Linux AMI 2014.03.1 64位)。 第二个EC2实例应该在同一个VPC子网中,但实际的IP地址并不重要。 它也不需要公共弹性IP。 它需要连接到外部世界,使用yum来安装软件。
这是我的Vagrantfile :
VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "dummy" config.vm.provider :aws do |aws, override| aws.access_key_id = "ACCESS_KEY_ID" aws.secret_access_key = "SECRET_ACCESS_KEY" aws.keypair_name = "KEYPAIR_NAME" aws.ami = "ami-2918e35e" aws.instance_type = "m1.small" aws.region = "eu-west-1" aws.subnet_id = "subnet-SUBNETID" aws.security_groups = "sg-SECURITYGROUPID" override.ssh.username = "ec2-user" override.ssh.private_key_path = "PRIVATE_KEY.pem" end config.ssh.pty = true config.vm.provision "shell", path: "provision.sh" end
在shell脚本provision.sh我安装了一些软件:
yum install -y subversion
这失败了,因为yum无法连接到外部networking。
当我做vagrant ssh并检查IP地址时,它位于10.0.0.0/24范围内,我可以在两个EC2实例之间ping任何一个方向(安全组中允许ICMP)。 我无法ping 8.8.8.8 ,我不能yum install软件,因为实例无法访问存储库。 我查了一下route和第一个例子一样。
另外,在AWS Web控制台中,第二个实例没有公共IP地址。
当我将这一行添加到我的Vagrantfile :
aws.associate_public_ip = true
那么在vagrant up --provider=aws --provision我得到以下错误vagrant up --provider=aws --provision :
There are errors in the configuration of this machine. Please fix the following errors and try again: AWS Provider: * The following settings shouldn't exist: associate_public_ip
并且实例不会启动。
所以我的问题是:如何在不使用弹性IP的情况下为stream动实例提供networking连接?
在我的安装,参数不存在,但有
aws.elastic_ip = true
有相同的目的。
要find你的插件中使用的真正的领域chech这个文件
~/.vagrant.d/gems/gems/vagrant-aws-0.4.1/lib/vagrant-aws/config.rb
当然我有你的vagrant-aws-0.4.1的改变