ec2 instance launch failing with error subnet id does not exit

12 views
Skip to first unread message

Sanjay Chakraborty

unread,
Jun 1, 2020, 8:54:16 PM6/1/20
to ansible...@googlegroups.com
Hi there,
Can anyone please let me know what should be the correct syntax for defining vpc subnet id ?  This is my playbook:
---
 - name: A play to launch ec2 instance
   hosts: localhost
   connection: local
   gather_facts: false
   vars:
    - proto: tcp
      ports:
       - 22
      cidr_ip: xxx.xx.xx.xx/16 
      rule_desc: allow all connection on port 22
   tasks:
    - name: Task to launch ec2 instance with default values
      ec2:
       key_name: xxxxxxx_key
       instance_type: t2.micro
       image: ami-xxxxxxxxx
       wait: yes
       count: 1
       region: us-east-1
       aws_access_key: xxxxxxxxxxxxxxx
       aws_secret_key: xxxxxxxxxxxxxxxxxxxxxx
       vpc_subnet_id: vpc-xxxx  ( copy pasted) 
       assign_public_ip: yes

    - name: Verbosity
      debug:
       msg: "ec2 output ..."
       verbosity: 4

Thanks.
Sanjay Chakraborty 

Neha Pithadiya

unread,
Jun 1, 2020, 11:43:02 PM6/1/20
to Ansible Project
Hi

I think vpc_subnet_id value looks like as:-
vpc_subnet_id: subnet-29e63245

Check the link below:-
https://docs.ansible.com/ansible/latest/modules/ec2_module.html

Thanks
Neha


Sanjay Chakraborty

unread,
Jun 2, 2020, 12:24:18 AM6/2/20
to ansible...@googlegroups.com
That helped. Also needed correct modules. 

Thanks.
Sanjay 

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/88d729e1-56bd-4e3c-a519-4af7e111b2d3%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages