2017-06-14 31 views
2

當我嘗試部署到Amazon EC2使用鹽的雲,我得到這個錯誤:鹽雲誤差部署到AWS

[[email protected] salt]# salt-cloud -p ec2_private_win_r3.xlarge server00009 
[ERROR ] AWS Response Status Code and Error: [401 401 Client Error: Unauthorized] {'Errors': {'Error': {'Message': 'AWS was not able to validate the provided access credentials', 'Code': 'AuthFailure'}}, 'RequestID': '33b43015-518e-4865-88e7-b6432e61b0db'} 
[ERROR ] AWS Response Status Code and Error: [401 401 Client Error: Unauthorized] {'Errors': {'Error': {'Message': 'AWS was not able to validate the provided access credentials', 'Code': 'AuthFailure'}}, 'RequestID': '4b88b080-ad32-4388-a133-4322b1c08c04'} 
[ERROR ] There was a profile error: 'NoneType' object has no attribute 'copy' 

我已驗證我使用AWS鍵和我米能夠列出,甚至使用AWS命令行與我使用的雲服務提供商文件中的密鑰推出新的實例:

## Gov Cloud Non Prod environment 
company-govcloud-nonprod-us-east-1: 
    # Set up the location of the salt master 

    minion: 
    master: 10.0.2.15 

    # Set up grains information, which will be common for all nodes 
    # using this driver 
    grains: 
    node_type: broker 

    # Valid options are: 
    #  private_ips - The salt-cloud command is run inside the EC2 
    #  public_ips - The salt-cloud command is run outside of EC2 
    # 
    ssh_interface: private_ips 

    # Optionally configure the Windows credential validation number of 
    # t-tdetries and delay between retries. This defaults to 10 retries 
    # with a one second delay betdwee retries 
    win_deploy_auth_retries: 10 
    win_deploy_auth_retry_delay: 1 

    # Set the EC2 access credentials (see below) 

    id: 'AKIAIATLQ4FTDDA6BV7A' 
    key: 'asdfasdsfadsadasasdafadsadfafasdasda’ 

    # Make sure this key is owned by root with permissions 0400. 
    # 
    private_key: /etc/salt/company-timd 
    keyname: company-timd 
    #securitygroup: core-sg-default 

    # Optionally configure default region 
    # Use salt-cloud --list-locations <driver> to obtain valid regions 
    # 
    location: us-east-1 
    availability_zone: us-east-1c 

    # Configure which user to use to run the deploy script. This setting is 
    # dependent upon the AMI that is used to deploy. It is usually safer to 
    # configure this individually in a profile, than globally. Typical users 
    # are: 
    # Amazon Linux -> ec2-user 
    # RHEL   -> ec2-user 
    # CentOS  -> ec2-user 
    # Ubuntu  -> ubuntu 
    # 
    ssh_username: root 

    # Optionally add an IAM profile 
    #iam_profile: 'arn:aws:iam::xxxxxxxxxxxx:role/rl-company-admin' 

    driver: ec2 

這是我想要使用的配置文件:

## Windows Server 2012 Alteryx & Tableau 
ec2_private_win_r3.xlarge: 
    provider: company-govcloud-nonprod-us-east-1 
    image: ami-xxxxxxx 
    size: r3.xlarge 
    network_interfaces: 
    - DeviceIndex: 0 
     SubnetId: subnet-xxxxxxx 
     SecurityGroupId: sg-xxxxxx 
     PrivateIpAddresses: 
     - Primary: True 
     AssociatePublicIpAddress: False 
    block_device_mappings: 
    - DeviceName: /dev/sda1 
    Ebs.VolumeSize: 120 
    Ebs.VolumeType: gp2 
    - DeviceName: /dev/sdf 
    Ebs.VolumeSize: 250 
    Ebs.VolumeType: gp2 
    tag: {'Engagement': '999999999999', 'Owner': 'Tim', 'Name': 'non-production', 'Environment': 'COMPANY-Grouper'} 

我試着在雲提供商定義中註釋掉IAM配置文件。我已經檢查過,我使用的AWS憑證在IAM中擁有管理員權限。

這裏是我的版本報告

[[email protected] ~]# salt-cloud --versions-report 
Salt Version: 
      Salt: 2016.11.5 

Dependency Versions: 
Apache Libcloud: 0.20.1 
      cffi: 1.6.0 
     cherrypy: 3.2.2 
     dateutil: 2.6.0 
     docker-py: Not Installed 
      gitdb: Not Installed 
     gitpython: Not Installed 
      ioflo: Not Installed 
      Jinja2: 2.7.2 
     libgit2: Not Installed 
     libnacl: Not Installed 
     M2Crypto: Not Installed 
      Mako: Not Installed 
    msgpack-pure: Not Installed 
    msgpack-python: 0.4.8 
    mysql-python: Not Installed 
     pycparser: 2.14 
     pycrypto: 2.6.1 
    pycryptodome: 3.4.3 
      pygit2: Not Installed 
      Python: 2.7.5 (default, Nov 6 2016, 00:28:07) 
    python-gnupg: Not Installed 
      PyYAML: 3.11 
      PyZMQ: 15.3.0 
      RAET: Not Installed 
      smmap: Not Installed 
     timelib: Not Installed 
     Tornado: 4.2.1 
      ZMQ: 4.1.4 

System Versions: 
      dist: centos 7.2.1511 Core 
     machine: x86_64 
     release: 3.10.0-327.el7.x86_64 
      system: Linux 
     version: CentOS Linux 7.2.1511 Core 

我怎樣才能解決這個問題?

+1

您使用的是什麼版本的'salt-cloud'?通過調試日誌記錄運行'salt-cloud'可能會清楚地知道哪一步失敗,併爲您提供更多線索。 – oeuftete

+0

嗨,我正在使用鹽雲2016.11.5(Carbon)。這裏有一些來自錯誤的調試輸出:https://gist.github.com/anonymous/664f2d4b64d453f03ce0c7c2140d6988 謝謝 – bluethundr

+0

你是否檢查過你的時間是同步的?有時需要AWS認證。 (運行:$ sudo ntpdate pool.ntp.org)。你也可以在Python中加入一個簡短的boto腳本來檢查你是否可以正常進行身份驗證。 –

回答

2

你試圖用ssh_username啓動一個Windows EC2實例嗎?這可能會打破它。

+0

是的,此刻嘗試啓動一個Windows實例。我試着在提供商配置中註釋掉所有的ssh文件。但沒有變化,我得到了同樣的錯誤:https://gist.github.com/bluethundr/13b2a03b6e71d99f9134ecd8d56945bf – bluethundr