2015-05-26 51 views
0

我想在私有子网上的VPC内部启动一个ec2实例。每次运行kitchen test时,我都能够使用正确的安全组和正确的子网范围启动实例。当测试厨房试图通过SSH连接到实例时,它会要求输入密码。但是,当我手动尝试ssh(ssh <private_ip> -i <path_to_ssh_key> -l ubuntu)到机器上时,我没有被提示输入密码。Kitchen-EC2 SSH提示VPC内部实例的密码

以下是我.kitchen.yml文件

--- 
driver: 
    name: ec2 
    aws_ssh_key_id: id-spanning 
    security_group_ids: ['sg-9....5'] 
    region: us-east-1 
    availability_zone: us-east-1a 
    require_chef_omnibus: true 
    subnet_id: subnet-5...0 
    associate_public_ip: false 
    instance_type: m3.medium 
    interface: private 

transport: 
    ssh_key: ~/.ssh/id-spanning.pem 
    connection_timeout: 10 
    connection_retries: 5 
    username: ubuntu 

provisioner: 
    name: chef_solo 

platforms: 
    - name: Ubuntu-14.04 
    driver: 
     image_id: ami-8821cae0 

suites: 
    - name: default 
    run_list: 
    attributes: 

我有AWS凭据对环境变量的地方。以下是我的输出。

kitchen test 
-----> Starting Kitchen (v1.4.0) 
-----> Cleaning up any prior instances of <default-Ubuntu-1404> 
-----> Destroying <default-Ubuntu-1404>... 
    EC2 instance <i-16f468c6> destroyed. 
    Finished destroying <default-Ubuntu-1404> (0m1.90s). 
-----> Testing <default-Ubuntu-1404> 
-----> Creating <default-Ubuntu-1404>... 
    Creating <>... 
If you are not using an account that qualifies under the AWS 
free-tier, you may be charged to run these suites. The charge 
should be minimal, but neither Test Kitchen nor its maintainers 
are responsible for your incurred costs. 

    Instance <i-8fad345f> requested. 
    EC2 instance <i-8fad345f> created. 
    Waited 0/300s for instance <i-8fad345f> to become ready. 
    Waited 5/300s for instance <i-8fad345f> to become ready. 
    Waited 10/300s for instance <i-8fad345f> to become ready. 
    Waited 15/300s for instance <i-8fad345f> to become ready. 
    Waited 20/300s for instance <i-8fad345f> to become ready. 
    Waited 25/300s for instance <i-8fad345f> to become ready. 
    EC2 instance <i-8fad345f> ready. 
    Password: 

我尝试了好几次,并没有绕过密码允许测试厨房ssh到实例的运气。以下是我的kitchen diagnose输出。使用

--- 
timestamp: 2015-05-26 15:34:29 UTC 
kitchen_version: 1.4.0 
instances: 
    default-Ubuntu-1404: 
    platform: 
     os_type: unix 
     shell_type: bourne 
    state_file: 
     hostname: '' 
     server_id: i-1.....6 
    driver: 
     associate_public_ip: false 
     availability_zone: us-east-1a 
     aws_access_key_id: 
     aws_secret_access_key: 
     aws_session_token: 
     aws_ssh_key_id: id-spanning 
     block_device_mappings: 
     ebs_optimized: false 
     flavor_id: 
     iam_profile_name: 
     image_id: ami-8821cae0 
     instance_type: m3.medium 
     interface: private 
     kitchen_root: "/Users/jonnas2/Desktop/apache101" 
     log_level: :info 
     name: ec2 
     price: 
     private_ip_address: 
     region: us-east-1 
     retryable_sleep: 5 
     retryable_tries: 60 
     security_group_ids: 
     - sg-9....5 
     shared_credentials_profile: 
     subnet_id: subnet-5....0 
     tags: 
     created-by: test-kitchen 
     test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration" 
     user_data: 
     username: 
    provisioner: 
     attributes: {} 
     chef_metadata_url: 
     chef_omnibus_install_options: 
     chef_omnibus_root: "/opt/chef" 
     chef_omnibus_url: https://www.chef.io/chef/install.sh 
     chef_solo_path: "/opt/chef/bin/chef-solo" 
     clients_path: 
     cookbook_files_glob: README.*,metadata {json,rb},attributes/**/*,definitions/**/*,files/**/*,libraries/**/*,providers/**/*,recipes/**/*,resources/**/*,templates/**/* 
     data_bags_path: 
     data_path: 
     encrypted_data_bag_secret_key_path: 
     environments_path: 
     http_proxy: 
     https_proxy: 
     kitchen_root: "/Users/jonnas2/Desktop/apache101" 
     log_file: 
     log_level: :info 
     name: chef_solo 
     nodes_path: 
     require_chef_omnibus: true 
     roles_path: 
     root_path: "/tmp/kitchen" 
     run_list: [] 
     solo_rb: {} 
     sudo: true 
     sudo_command: sudo -E 
     test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration" 
    transport: 
     compression: zlib 
     compression_level: 6 
     connection_retries: 5 
     connection_retry_sleep: 1 
     connection_timeout: 10 
     keepalive: true 
     keepalive_interval: 60 
     kitchen_root: "/Users/jonnas2/Desktop/apache101" 
     log_level: :info 
     max_wait_until_ready: 600 
     name: ssh 
     port: 22 
     ssh_key: "/Users/jonnas2/.ssh/id-spanning.pem" 
     test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration" 
     username: ubuntu 
    verifier: 
     busser_bin: "/tmp/verifier/bin/busser" 
     http_proxy: 
     https_proxy: 
     kitchen_root: "/Users/jonnas2/Desktop/apache101" 
     log_level: :info 
     name: busser 
     root_path: "/tmp/verifier" 
     ruby_bindir: "/opt/chef/embedded/bin" 
     sudo: true 
     sudo_command: sudo -E 
     suite_name: default 
     test_base_path: "/Users/jonnas2/Desktop/apache101/test/integration" 
     version: busser 

版本: test-kitchen 1.4.0 kitchen-ec2 0.9.0

任何帮助将不胜感激。谢谢。

回答