0 votes
1 view
in AWS by (1.6k points)

This is my ansible-playbook  

---

- hosts: localhost

  connection: local

  tasks:

    - include_vars: aws_credentials.yml

    - name: Creating EC2 Ubuntu instance

      ec2:

        instance_type: t2.micro

        image: ami-86e0ffe7

        region: us-west-1

        key_name: my-key

        zone: us-west-1a

        vpc_subnet_id: subnet-04134e61

        group_id: sg-cf6754ba

        assign_public_ip: yes

..

but I'm getting the error "Could not create Ec2 instance". Any Solution for this 

 

1 Answer

0 votes
by (3.1k points)

Here you should have provided keys directly to EC2 modules

- name: Creating EC2  instance

      ec2:

        aws_access_key: "{{ ec2_access_key }}"

        aws_secret_key: "{{ ec2_secret_key }}"

        instance_type: t2.micro

        image: ami-86e0ffe7

        region: us-west-1

        ...

Want to learn more about AWS, visit: AWS Training

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 21 in AWS by devin (1.6k points)
0 votes
1 answer
asked Nov 6 in AWS by Sudhir_1997 (46.8k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...