How do I create AWS Resources Using Ansible?
Ansible provides set of built-in modules which are used to configure the AWS resources. BU using this ansible modules you can configure AWS resources like EC2 instance,S3 buckets,load balancer and autoscaling and son on.
Follow the steps mentioned below to create EC2 instance using Ansible
Step 1: Install the required modules in ansible to configure the AWS resources. You can install by using the following command.
ansible-galaxy install
Step 2: Create an playbook by using the yaml file and mention the configurations required to create AWS ec2 instance following is the sample YAML file to create AWS EC2 instance.
---
- hosts: localhost
tasks:
- name: Create an EC2 instance
ec2:
instance_type: t2.micro
ami: ami-0b7927eb9e3372e28
state: present
tags:
Name: MyEC2Instance
Create EC2 Instance in AWS (Amazon): Complete Tutorial
EC2 stands for Elastic Compute Cloud. EC2 is an on-demand computing service on the AWS cloud platform. Under computing, it includes all the services a computing device can offer to you along with the flexibility of a virtual environment. It also allows the user to configure their instances as per their requirements i.e. allocate the RAM, ROM, and storage according to the need of the current task.
Amazon EC2 is a short form of Elastic Compute Cloud (ECC) it is a cloud computing service offered by the Cloud Service Provider AWS. You can deploy your applications in EC2 servers without worrying about the underlying infrastructure. You configure the EC2-Instance in a very secure manner by using the VPC, Subnets, and Security groups. You can scale the configuration of the EC2 instance you have configured based on the demand of the application by attaching the autoscaling group to the EC2 instance. You can scale up and scale down the instance based on the incoming traffic of the application.