How to launch an EC2 instance using Ansible Playbook

0 votes

Hi Guys,

I am new in Ansible. I want to launch one EC2 instance using Ansible-Playbook. Can anyone tell me how can I do that?

Aug 12, 2020 in Ansible by akhtar
• 38,230 points
1,707 views

1 answer to this question.

0 votes

Hi@akhtar,

Ansible has one module named ec2. This is a module that is used to connect AWS from Ansible-Playbook. I have attached one playbook below for your reference.

- hosts: localhost
  tasks:
  - name: AWS OS provisioning
    ec2:
      key_name: keymlops
      instance_type: t2.micro
      image: ami-0ebc1ac48dfd14136
      wait: yes
      region: ap-south-1
      group_id: sg-01a7d863
      count: 1
      vpc_subnet_id: subnet-51167d1d
      assign_public_ip: yes
      aws_access_key:
      aws_secret_key: 

answered Aug 12, 2020 by MD
• 95,440 points

Related Questions In Ansible

0 votes
1 answer

Ansible playbook to automate security configurations of an EC2 instance

Hey @Kiara, your indentation is very wrong. ...READ MORE

answered Jan 24, 2019 in Ansible by Harsh
578 views
0 votes
1 answer

How to launch MySQL docker container using Ansible playbook?

Hi@akhtar, You can use docker_container module in your ...READ MORE

answered Sep 21, 2020 in Ansible by MD
• 95,440 points
3,683 views
0 votes
1 answer

How to create an S3 bucket using Ansible Playbook?

Hi@akhtar, Ansible has a module that can create ...READ MORE

answered Dec 4, 2020 in Ansible by MD
• 95,440 points
1,958 views
0 votes
1 answer

How to create an encrypted bucket in AWS using Ansible Playbook?

Hi@akhtar, Sometimes it is required to encrypt the ...READ MORE

answered Dec 4, 2020 in Ansible by MD
• 95,440 points
557 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,458 views
+2 votes
1 answer
0 votes
1 answer

How to do SSH in EC2 instance using Ansible Playbook?

Hi@akhtar, To configure your inventory dynamically you need ...READ MORE

answered Sep 21, 2020 in Ansible by MD
• 95,440 points
2,147 views
0 votes
1 answer

How to create an ec2 snapshot using Ansible Playbook?

Hi@akhtar, You can create an EC2 snapshot from an existing ...READ MORE

answered Dec 4, 2020 in Ansible by MD
• 95,440 points
1,359 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP