2017-01-09 3 views
-1
--- 
- hosts: localhost 
    gather_facts: false 
    vars: 
    keypair: id_rsa 
    instance_type: t2.micro 
    image: ami-6f68cf0f 
    region: us-west-2 


    tasks: 
    - name: launch ec2-instance 
     ec2: 
     key_name: "{{ keypair }}" 
     instance_type: "{{ instance_type }}" 
     image: ami-6f68cf0f 
     wait: true 
     group: wide-open 
     region: "{{ region }}" 
     aws_access_key: '************' 
     aws_secret_key: '********************************' 
     register: ec2 

내가 실행 어떤이를 시작 ansible 각본에 작업을 실행하는 동안 발생하지만 그것은 당신이받은 오류 메시지가이 경우에 상당히 좋은 일이다예외가 EC2 인스턴스를

Traceback (most recent call last): 
    File "/root/.ansible/tmp/ansible-tmp-1483922048.3-267705964376313/ec2", line 3628, in <module> 
    main() 
    File "/root/.ansible/tmp/ansible-tmp-1483922048.3-267705964376313/ec2", line 1413, in main 
    (instance_dict_array, new_instance_ids, changed) = create_instances(module, ec2, vpc) 
    File "/root/.ansible/tmp/ansible-tmp-1483922048.3-267705964376313/ec2", line 898, in create_instances 
    grp_details = ec2.get_all_security_groups() 
    File "/usr/lib/python2.6/site-packages/boto/ec2/connection.py", line 2984, in get_all_security_groups 
    [('item', SecurityGroup)], verb='POST') 
    File "/usr/lib/python2.6/site-packages/boto/connection.py", line 1186, in get_list 
    raise self.ResponseError(response.status, response.reason, body) 
boto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized 
<?xml version="1.0" encoding="UTF-8"?> 
<Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>5d241900-6b6e-4398-aba3-16d5738fb6d5</RequestID></Response> 

fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_name": "ec2"}, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1483922048.3-267705964376313/ec2\", line 3628, in <module>\n main()\n File \"/root/.ansible/tmp/ansible-tmp-1483922048.3-267705964376313/ec2\", line 1413, in main\n (instance_dict_array, new_instance_ids, changed) = create_instances(module, ec2, vpc)\n File \"/root/.ansible/tmp/ansible-tmp-1483922048.3-267705964376313/ec2\", line 898, in create_instances\n grp_details = ec2.get_all_security_groups()\n File \"/usr/lib/python2.6/site-packages/boto/ec2/connection.py\", line 2984, in get_all_security_groups\n [('item', SecurityGroup)], verb='POST')\n File \"/usr/lib/python2.6/site-packages/boto/connection.py\", line 1186, in get_list\n raise self.ResponseError(response.status, response.reason, body)\nboto.exception.EC2ResponseError: EC2ResponseError: 401 Unauthorized\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response><Errors><Error><Code>AuthFailure</Code><Message>AWS was not able to validate the provided access credentials</Message></Error></Errors><RequestID>5d241900-6b6e-4398-aba3-16d5738fb6d5</RequestID></Response>\n", "module_stdout": "", "msg": "MODULE FAILURE", "parsed": false} 
+0

오류 메시지 : _EC2ResponseError : 401 Unauthorized AuthFailure AWS가 제공된 액세스 자격 증명의 유효성을 검사하지 못했습니다. 이걸 확인해 봤어? –

+1

그리고 질문은 ...? – techraf

답변

1

다음과 같은 오류를 보여줍니다 AWS was not able to validate the provided access credentials

여기에있는 자격 증명은 AWS 계정의 자격 증명입니다. 특히 aws_access_keyaws_secret_key 개의 변수가 있습니다.

그 변수에 맞는 값을 얻고, 자신이 가진 자격 증명/자신의 백업을 발행 한 사람이 부여한 것에 대해 가지고있는 것을 확인하면됩니다.

관련 문제