测试厨房(chefdk),Vagrant和亚马逊VPC

时间:2015-02-22 15:46:41

标签: amazon-ec2 vagrant amazon-vpc test-kitchen

我试图让KitchenCI在我的Amazon VPC中构建测试实例。我有这个工作,但是当Vagrant尝试连接到ec2实例时,它使用实例的外部(公共)IP与其内部(VPC)IP。有没有办法在Vagrant中改变这个?

.kitchen.yml:

---
provisioner:
   name: chef_solo

platforms:
  - name: centos-6.5
    driver:
      name: vagrant
  - name: amazon
    driver:
      name: ec2
      image_id: ami-ed8e9284
      flavor_id: t2.medium
      aws_ssh_key_id: DevOps
      ssh_key: /Users/djimenez/.ssh/devops_rsa.pub
      availability_zone: us-east-1a
      subnet_id: subnet-1903a976
      require_chef_omnibus: true
      iam_profile_name: atc
      ebs_delete_on_termination: true
      security_group_ids: sg-7461ae1b

suites:
 <snip>

1 个答案:

答案 0 :(得分:0)

看起来我需要将以下内容添加到我的.kitchen.yml:

driver:
  name: ec2
  interface: private

docs说:

  

接口

     

从中导出主机名以与之通信的位置   实例。可能是dns,公共或私人。如果未设置,则为驱动程序   将通过以下顺序失败来派生主机名:

     
      
  1. DNS名称
  2.   
  3. 公共IP地址
  4.   
  5. 私人IP地址
  6.         

    默认设置为未设置。